Terraform commands
auto approve
terraform apply -auto-approveinitialize
terraform initpreview terraform actions
The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure. By default, when Terraform creates a plan it:
Reads the current state of any already-existing remote objects to make sure that the Terraform state is up-to-date.
Compares the current configuration to the prior state and noting any differences.
Proposes a set of change actions that should, if applied, make the remote objects match the configuration.
terraform planapply configuration with variables
terraform apply -var-file terraform-dev.tfvarsdestroy a single resource
terraform destroy -target aws_vpc.myapp-vpcdestroy everything fromtf files
terraform destroyshow resources and components from current state
terraform state listshow current state of a specific resource/data
terraform state show aws_vpc.myapp-vpc set avail_zone as custom tf environment variable - before apply
export TF_VAR_avail_zone="eu-west-3a"Last updated