Terraform workspaces wit gitlab CICD
Posted on Jan 3, 2020
1 min read
Overview
Using terraform workspaces with a little python code and gitlab cicd pipelines to create a dynamic, interesting
pipeline.
Use case
Company: Renovo
We wanted to create a single terraform manifest that could express complicated infrastructure requirements with
environmental deltas. A single, simple implementation, but with each environment express uniqueness based on the
environmental needs.
➜ raleigh git:( master) terraform workspace list
* default
➜ raleigh git:( master) * terraform workspace new stage*
Created and switched to workspace "stage" !
You're now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.
➜ raleigh git:(master) terraform workspace new production
Created and switched to workspace "production"!
You' re now on a new, empty workspace. Workspaces isolate their state,
so if you run "terraform plan" Terraform will not see any existing state
for this configuration.
➜ raleigh git:( master) terraform workspace list
default
* production
stage
terraform gitlab cicd
Share This Post