terraform-template/README.md

1.3 KiB

My Personal Terraform Template

Featuring

How to use

  1. Template it
  2. Provide S3 Backend Configuration in backend.hcl and input key in providers.tf
  3. Provide Vault Configuration in vault.hcl and input key for state file isolation in providers.tf
  4. Configure AWS with:
AWS configure sso
# fill in ~profile
aws-vault exec ~profile #duration in providers.tf - 1h or less recommended
terraform init -backend-config=backend.hcl && terraform plan
terraform apply

Isolation of state

To isolate within the same configuration, use workspaces. To isolate between configurations, use file layout.

Workspaces

to list workspaces:

terraform workspace list
# default at start

to create a workspace:

terraform workspace new ~workspace

to select a workspace:

terraform workspace select ~workspace

TODO

  • Azure support
  • GCP support