Create and switch to a workspace

Create a new workspace and switch to it

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 the resource dependency graph as SVG and open it (needs Graphviz)

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

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

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

    Change a resource address without destroying it; in newer Terraform, use a moved{} block instead

  • terraform state rm 'aws_s3_bucket.legacy'

    Forget a resource in state without deleting the real infrastructure; the object keeps running

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

    Show all attributes of one address to investigate drift or bugs

all 43 terraform commands