/terraform-workspaces

Terraform workspaces example

Primary LanguageHCL

Terrafrom workspaces example for AWS S3

Terraform commands required to run this project

#initialize env specific workspace , pass appropriate backend file as argument. 
terraform init -backend-config=backends/prod-env.tf

#create new workspace ( from command line)
terraform workspace new "dev"
 
#change to an existing workspace
terraform workspace select "dev"
 
#then run terraform init, plan & apply as you would normally do in any terraform project
terraform plan 
terraform apply

Refe to this article for indepth explanation of workspaces and this repo in perticular. http://i-cloudconsulting.com/terraform-workspaces/