Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Migrate an Existing Terraform Project into Terraform Cloud

In this hands-on lab, we will take an existing Terraform configuration and convert it to run the code using Terraform Cloud. We will use the CLI-driven method to deploy our resources to AWS with Terraform Cloud doing the bulk of the work.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Sep 24, 2025
Duration
1h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Prepare the Environment
    1. Log in to the lab instance.

    2. Clone the lab repo to your lab machine:

      git clone https://github.com/ACloudGuru-Resources/content-introduction-terraform-cloud-lab.git
      
    3. Create the terraform-guru organization.

    4. Select CLI-driven workflow.

    5. Create the terraform-cloud-guru workspace.

    6. Create a variable set by going to your workspace settings and then Variable sets. Click Create variable set.

    7. Use AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.

    8. In the AWS Management Console, create an access key for the cloud_user and secret access key, and use those values for the variable set.

    9. In the user settings, create a token for the CLI to use with Terraform Cloud called terraform-cloud. You must copy the key, run terraform login in your terminal, and follow the prompts.

  2. Challenge

    Migrate the Existing Terraform Project into Terraform Cloud
    1. Modify the main.tf file, and add the Terraform Cloud config.
    2. Add the Terraform variables in Terraform Cloud for your workspace for the ami, instance_count,instance_type, and subnet

      Note: You will need to look this up from the console or CLI. All other variables will be in the variables.tf file.

    3. Modify the variables so they use the Terraform Cloud variables.
  3. Challenge

    Deploy the EC2 Instances with Terraform Cloud
    1. Initialize your working directory.
    2. Validate your code.
    3. Apply your configuration, and view it in your terminal and Terraform Cloud Runs section.
    4. Check the AWS Management Console to verify the instances were created.
  4. Challenge

    Create a Terraform Module from Existing Code
    1. Create a GitHub repo called terraform-as-ec2-psacg.
    2. Add the Terraform Cloud application, and configure it.
    3. Add the module configuration to your repo called main.tf.
    4. Add a tag to the repo of 1.0.0.
    5. Add the module to Terraform Cloud Registry.
  5. Challenge

    Modify the Terraform Configuration to use the Module and Redeploy
    1. Edit the main Terraform configuration to use the module.
    2. Initialize the Terraform working directory.
    3. Validate the syntax.
    4. Apply your new configuration.
    5. Confirm the changes.
About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight