Playing around with multi-account structure. I aim to have each account to store state in an s3 bucket of their account. Then hoping that subsequent module declarations would inherit the iam_role
delcared in the terraform.tfvars
just under the root account folder (banana or kiwi). But iam_role
seems to get ignored when using terragrunt apply-all. I can, however export the role with export TERRAGRUNT_IAM_ROLE=...
and run terragrunt apply-all under each account, and the resources are created as expected.
├── accounts
│ ├── banana
│ │ ├── terraform.tfvars
│ │ └── us-east-1
│ │ └── ecs_cluster
│ │ └── terraform.tfvars
│ └── kiwi
│ ├── terraform.tfvars
│ └── us-east-1
│ └── ecs_cluster
│ └── terraform.tfvars
└── modules
└── ecs_cluster
├── README.md
├── main.tf
├── outputs.tf
└── vars.tf
Sample terraform.tfvars under banana:
terragrunt = {
remote_state {
backend = "s3"
config {
bucket = "banana-state"
key = "${path_relative_to_include()}/terraform.tfstate"
region = "us-east-1"
role_arn = "arn:aws:iam::0123456789:role/provisioner"
}
}
iam_role = "arn:aws:iam::0123456789:role/provisioner"
}