Added for_each loops to make looping over maps easier

This commit is contained in:
Patrick de Ruiter 2021-09-07 11:06:12 +02:00
parent 54fc2fb693
commit 056ea07811
2 changed files with 33 additions and 8 deletions

View File

@ -1,9 +1,10 @@
module "datadog_integration" { module "datadog_integration" {
source = "cloudposse/datadog-integration/aws" source = "cloudposse/datadog-integration/aws"
version = "0.11.0" version = "0.11.0"
namespace = "plaap" for_each = var.aws_accounts
stage = "test" namespace = "${each.value.namespace}"
name = "datadog-integration" stage = "${each.value.environment}"
name = "datadog-integration-${each.value.prefix_slug}-${each.value.team}-${each.value.environment}"
integrations = [ "all" ] integrations = [ "all" ]
} }

View File

@ -24,10 +24,34 @@ variable "aws_profile" {
description = "Which AWS account is this for" description = "Which AWS account is this for"
} }
variable "prefix_slug" { variable "aws_accounts" {
type = string description = "Map of AWS accounts to configuration."
type = map
default = {
vnn-bingel-prd = {
aws_account_id = "",
namespace = "datadog",
environment = "prd",
prefix_slug = "vnn",
region = "eu-west-1",
team = "bingel"
},
vnn-dbw-prd = {
aws_account_id = "",
namespace = "datadog",
environment = "prd",
prefix_slug = "vnn",
region = "eu-west-1",
team = "dbw"
}
mbg-sesame-prd = {
aws_account_id = "",
namespace = "datadog",
environment = "prd",
prefix_slug = "mbg",
region = "eu-west-1",
team = "sesame"
}
}
} }
variable "team" {
type = string
}