Workspace create and switch

Create and activate a Terraform workspace

terraform workspace new staging && terraform workspace select staging

tool
terraform43 commands
tags
terraform

More terraform commands

  • terraform graph | dot -Tsvg > graph.svg && open graph.svg

    Render resource dependency graph as SVG (requires graphviz)

  • terraform providers lock -platform=linux_amd64 -platform=darwin_arm64

    Lock provider versions for multiple platforms in .terraform.lock.hcl

  • terraform state mv 'aws_instance.web' 'aws_instance.app'

    Rename/refactor address without destroy; prefer moved{} block in newer TF

  • terraform state rm 'aws_s3_bucket.legacy'

    Forget resource from state without deleting real infra; note: object keeps existing

  • terraform state show 'module.vpc.aws_subnet.private[0]'

    Dump all attributes of one resolved address for drift/debug investigation

all 43 terraform commands