-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterragrunt.hcl
38 lines (35 loc) · 1.11 KB
/
terragrunt.hcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
locals {
env = read_terragrunt_config(find_in_parent_folders("env.hcl"))
region = read_terragrunt_config(find_in_parent_folders("region.hcl"))
account = read_terragrunt_config(find_in_parent_folders("account.hcl"))
prefix_name = local.account.locals.prefix_name
account_id = local.account.locals.account_id
region_name = local.region.locals.region_name
environment_name = local.env.locals.environment_name
}
generate "provider" {
path = "provider.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
provider "aws" {
region = "${local.region_name}"
allowed_account_ids = [
${local.account_id}
]
}
EOF
}
remote_state {
backend = "s3"
config = {
encrypt = true
bucket = "${local.prefix_name}-${local.region_name}-${local.account_id}-${local.environment_name}"
key = "${path_relative_to_include()}/terraform.tfstate"
region = local.region_name
dynamodb_table = local.prefix_name
}
generate = {
path = "backend.tf"
if_exists = "overwrite_terragrunt"
}
}