I'm creating private subnets with Terraform:
resource "aws_subnet" "private" {
count = length(data.aws_availability_zones.available.names)
vpc_id = aws_vpc.main_vpc.id
cidr_block = cidrsubnet(var.vpc_cidr, 8, count.index + 10)
availability_zone = element(data.aws_availability_zones.available.names, count.index)
map_public_ip_on_launch = false
tags = {
Name = "${var.client_code}-${var.environment}-private-${element(data.aws_availability_zones.available.names, count.index)}"
}
}
Later I'm trying to create SSM parameter with:
resource "aws_ssm_parameter" "private_subnets_ids" {
name = "/${var.client_code}-${var.environment}/backend/SUBNET_IDS"
type = "StringList"
value = aws_subnet.private.*.id
}
As subnets resource is making three subnets, it raises the following error:
4: value = aws_subnet.private.*.id
|----------------
| aws_subnet.private is tuple with 3 elements
Inappropriate value for attribute "value": string required.
How should I pass this three element tuple to the StringList
type parameter?