0
0
Terraformcloud~30 mins

Terraform Cloud/Enterprise features - Mini Project: Build & Apply

Choose your learning style9 modes available
Terraform Cloud/Enterprise Features Setup
📖 Scenario: You are working as a cloud engineer for a company that wants to manage infrastructure using Terraform Cloud. Your task is to create a Terraform configuration that sets up a workspace with specific features enabled in Terraform Cloud.
🎯 Goal: Build a Terraform configuration that defines a Terraform Cloud workspace with version control integration, automatic runs enabled, and workspace variables configured.
📋 What You'll Learn
Create a Terraform Cloud workspace resource named example_workspace.
Set the workspace to use the main branch from a GitHub repository.
Enable automatic runs on changes.
Add a workspace variable named environment with the value production.
Configure the workspace to use Terraform version 1.5.0.
💡 Why This Matters
🌍 Real World
Terraform Cloud workspaces help teams manage infrastructure as code with collaboration, version control, and automation.
💼 Career
Knowing how to configure Terraform Cloud workspaces is essential for cloud engineers and DevOps professionals managing infrastructure deployments.
Progress0 / 4 steps
1
Create Terraform Cloud workspace resource
Write a Terraform resource block named terraform_cloud_workspace with the resource name example_workspace. Set the name attribute to example-workspace.
Terraform
Need a hint?

Use the resource keyword to define a Terraform Cloud workspace resource with the exact name and resource identifier.

2
Configure version control and automatic runs
Add the vcs_repo block inside the terraform_cloud_workspace.example_workspace resource. Set identifier to github-user/repo-name and branch to main. Also, set auto_apply to true to enable automatic runs.
Terraform
Need a hint?

Use the vcs_repo block to connect the workspace to a GitHub repo and set auto_apply to true to enable automatic runs.

3
Add workspace variable
Inside the terraform_cloud_workspace.example_workspace resource, add a variable block. Set key to environment, value to production, and category to terraform.
Terraform
Need a hint?

Add a variable block with the exact key, value, and category to set workspace variables.

4
Set Terraform version for the workspace
Add the terraform_version attribute to the terraform_cloud_workspace.example_workspace resource and set it to "1.5.0".
Terraform
Need a hint?

Set the terraform_version attribute to specify the Terraform version used by the workspace.