Backend S3 + DynamoDB
terraform {
backend "s3" {
bucket = "meu-tf-state"
key = "prod/app.tfstate"
region = "sa-east-1"
dynamodb_table = "tf-locks"
encrypt = true
}
}
terraform init -migrate-state
Workspaces (opcional)
terraform workspace new staging
terraform workspace select prod
Em projetos maiores, prefira pastas/envs separados ou Terragrunt em vez de muitos workspaces.
Próximo · Projeto final e boas práticas