Terraform commands
auto approve
terraform apply -auto-approve
initialize
terraform init
preview 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 plan
apply configuration with variables
terraform apply -var-file terraform-dev.tfvars
destroy a single resource
terraform destroy -target aws_vpc.myapp-vpc
destroy everything fromtf files
terraform destroy
show resources and components from current state
terraform state list
show 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