Let’s start by checking out an existing branch of the vulnerable-ec2 repository you’ve downloaded before. In your working environment, run these commands to start from your home directory and checkout the branch named ‘tfc’.
You should have some local changes, we’ll stash them before proceeding.
cd /Workshop/vulnerable-ec2 && \
git stash && \
git checkout tfc
Your Terraform Cloud workspace should look something like this in the UI, follow the instructions below
Setup your Terraform Cloud account in the CLI, refer to Partner Setup Module > HashiCorp Terraform Cloud section
export TF_TOKEN_app_terraform_io="<your_token_here>"
Configure your Terraform Cloud org & workspace, refer Partner Setup section for more context.
vi main.tf
Change the fields below for your terraform cloud organization and workspace and also the AWS region (e.g us-west-2) under provider "aws"
# add org & workspace names below
terraform {
cloud {
organization = "organization-name-here"
workspaces {
name = "workspace-name-here"
}
}
provider "aws" {
# Configuration options
# WORKSHOP: Specify the region you like to use, especially if you plan on using your keypair to access your EC2 instance.
region = "us-west-2"
}
.
.
.