Skip to content

Instantly share code, notes, and snippets.

@TWinsnes
Created January 23, 2023 20:49
Show Gist options
  • Save TWinsnes/b4a79583e02c56f7dc5fe06eed2a0346 to your computer and use it in GitHub Desktop.
Save TWinsnes/b4a79583e02c56f7dc5fe06eed2a0346 to your computer and use it in GitHub Desktop.
Adding multiple accounts to have using terraform and for_each
# more info about for_each here: https://developer.hashicorp.com/terraform/language/meta-arguments/for_each
provider "hava" {
# alternatively use the HAVA_TOKEN environment variable
api_token = "xxx"
}
local (
accounts = toset([]
{
name = "Account 1"
role_arn = "arn:aws:iam::12341234:role/HavaRO"
},
{
name = "Account 2"
role_arn = "arn:aws:iam::12345123:role/HavaRO"
}
])
)
resource "hava_source_aws_car_resource" "example" {
for_each = local.accounts
name = each.value.name
role_arn = each.value.role_arn
external_id = "0934086b5ab9970205878266249aebd9"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment