Skip to content

Instantly share code, notes, and snippets.

@sairamkrish
Created February 18, 2022 19:35
Show Gist options
  • Save sairamkrish/5ea71f923fe6c5c0a1926ed07f1eea7d to your computer and use it in GitHub Desktop.
Save sairamkrish/5ea71f923fe6c5c0a1926ed07f1eea7d to your computer and use it in GitHub Desktop.
docker-compose run --rm terraform init
docker-compose run --rm terraform fmt
docker-compose run --rm terraform validate
docker-compose run --rm terraform plan
docker-compose run --rm terraform apply
# useful terraform sub commands
terraform state list
terraform state show <resource>
terraform output #shows last output
terraform refresh #without applying, fetches values for output variables
terraform destroy -target <resource> #delete only a particular resource.
terraform apply -target <resource> #apply individual resource
terraform plan -var 'environment=stg' # passing variables
terraform graph -type=plan | dot -Tpng -o graph.png # outputs the plan as DOT (graphviz) diagram
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment