ποΈ Day 7 of the 30-Day Terraform Challenge β state isolation deep dive. Implemented both Terraform Workspaces and File Layout isolation for multi-environment deployments. Knowing when to use each one is what separates good infrastructure from great infrastructure. #30DayTerraformChallenge #TerraformChallenge #Terraform #IaC #DevOps #AWSUserGroupKenya #EveOps
LAB β PART 1
First, I created three workspaces named dev, staging and production.
Then, I switched to the dev workspace and ran terraform apply. The resource was successfully created.
Next, I switched to the staging workspace and executed terraform plan to validate the configuration.
The (EC2) resource was created successfully with instance type βt3.smallβ
Now, while working in the staging environment Iβll destroy the resource.
Only the web-staging machine was destroyed.
LAB β PART 2
ISOLATION VIA FILE LAYOUTS
First, I created bootstrap resources. S3 Resource to save the terraform.state of dev and production environment.
Next, I configure the backends files to set the parameter of the S3 name. I pushed terraform plan and terraform apply.
The resource terraform.tfstate was successfully created in S3.
Next, I pushed terraform apply to create the terraform.tfstate file for production environment.










Top comments (0)