Skip to main content

Create a Terraform Cloud Workspace

For this tutorial you'll create a demo Terraform Cloud workspace, which is how Terraform Cloud manages collections of infrastructure resources. You will use the Terraform CLI to create this new workspace.

Clone the Demo Repo

First, clone the example GitHub repository for this tutorial, which includes the Terraform configuration files for the Fake Web Services provider and connection to Terraform Cloud. The Terraform Fake Web Services provider allows you to create and manage infrastructure resources in the same manner as you would manage cloud resources via Terraform for AWS, GCP, or Azure without creating actual cloud resources or interacting with a cloud provider.

To start, in your terminal run:

git clone

Then change to the cloned repository's directory:

cd tfc-das-tutorial

Initialize Terraform Cloud Workspace

Open the file in your preferred code editor, update the organization value in the cloud block to the your Terraform Cloud organization name, and save your changes. You can find your organization name displayed in the top-left of the Terraform Cloud console, or refer to Terraform Cloud's Organization Settings documentation for details on how to find your organization name.

In your terminal, run terraform init to create the Terraform Cloud workspace and install the Fake Web Services provider.

Figure 1 - Initialize Terraform CloudFigure 1 - Initialize Terraform Cloud

Once the command finishes running, you can go to Terraform Cloud to see your new workspace:

Figure 2 - Workspace in Terraform CloudFigure 2 - Workspace in Terraform Cloud

Set Provider Token

Similar to how a cloud provider configuration requires a token to interact with the provider, the Fake Web Services provider requires a Terraform Cloud user API token. For details about user API tokens and how to generate one, refer to Terraform Cloud's User API Tokens documentation.

Next, you will need to add a variable for your Terraform Cloud workspace with the token value. Following the steps in Terraform Cloud's Workspace-Specific Variables documentation, add a Workspace environment variable with a TF_VAR_PROVIDER_TOKEN key and value set to the generated user API token from above. Ensure you check the Sensitive checkbox to protect the token value, then click Save variable.

Figure 3 - Add Workspace VariableFigure 3 - Add Workspace Variable

Create Your First Infrastructure Resource

The example repo for this tutorial includes a VPC resource definition for the Fake Web Services provider with a CIDR block of in the file:

resource "fakewebservices_vpc" "primary_vpc" {
name = "Primary VPC"
cidr_block = ""

In your terminal, run terraform apply and confirm the plan by typing yes. Terraform will now create the defined fake VPC resource.