Basic Workflow

terraform fmt -check -recursive
terraform init
terraform validate
terraform plan -out=tfplan
terraform show tfplan
# After reviewing and approving the plan
terraform apply tfplan

Manage provider versions and the lock file in the repository. Plans and state may contain sensitive values; do not paste their raw contents into documents or chat.

Importing Existing Resources

Write the resource configuration first and verify that its address matches the actual resource. Since tf is a personal alias, use terraform consistently in documentation.

terraform import 'module.domain.aws_route53_record.a[0]' 'HOSTED_ZONE_ID_api.example.com_A'
terraform plan

Route 53 import identifiers can vary by record type and routing policy. Check the AWS provider documentation as well.

In Terraform versions supporting configuration-driven import, use an import block to include imports in change review.

import {
  to = module.domain.aws_route53_record.a[0]
  id = "HOSTED_ZONE_ID_api.example.com_A"
}

Team Operations

Official References

Related Blog Reading Notes

Powered by Fruition