Terraform Reminders

3/10/2021 6:27:27 PM

Some simply reminders for working with Terraform.

 

Standard Commands

terraform init

terraform plan

terraform apply

terraform state

terraform state list

terraform state rm

terraform untaint module.my_project.aws_elasticache_replication_group.main[0]

terraform plan -target=module.mymodule.aws_instance.myinstance

terraform apply -target=module.mymodule.aws_instance.myinstance

 

Verbose logging when running "apply"

TRACE, DEBUG, INFO, WARN or ERROR

$env:TF_LOG="TRACE"
$env:TF_LOG="INFO"
$env:TF_LOG="INFO"
$env:TF_LOG="WARN"

this works best for determining errors
$env:TF_LOG="DEBUG"