Menu

Terragrunt remote_state and generate blocks
📰

Terragrunt remote_state and generate blocks

DEV Community·Bartłomiej Danek·7 months ago
#rH9yssdp
#terraform#terragrunt#hcl#devops#software
Reading 0:00
15s threshold

Terragrunt remote_state and generate blocks

remote_state

Defines the backend once in root.hcl - Terragrunt auto-generates the backend config for every unit that includes it.

# root.hcl remote_state { backend = "s3" config = { bucket = "my-tf-state" key = "${path_relative_to_include()}/terraform.tfstate" region = "eu-west-1" encrypt = true dynamodb_table = "terraform-locks" } generate = { path = "backend.tf" if_exists = "overwrite_terragrunt" } }

Enter fullscreen mode

Exit fullscreen mode

path_relative_to_include() resolves to the path of the calling terragrunt.hcl relative to root.hcl - e.g.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.