Reputation: 475
I have created a vpc and security group with terraform and stored the values on the ssm parameter store
resource "aws_ssm_parameter" "private_subnets" {
name = "/infra/vpc/private_subnets"
type = "String"
value = join(",", module.vpc.private_subnets)
}
resource "aws_ssm_parameter" "sg" {
name = "/infra/vpc/sg"
type = "String"
value = aws_security_group.lambda.id
}
with sam-template I am trying to deploying a lambda function on the private subnet
Globals:
Function:
Runtime: java11
Timeout: 20
Architectures:
- x86_64
MemorySize: 512
VpcConfig:
SecurityGroupIds:
- '{{resolve:ssm:/infra/vpc/sg}}'
SubnetIds: !Split [ ",", '{{resolve:ssm:/infra/vpc/private_subnets}}' ]
But the sam is not able to split the string of private subnets to list of private subnets.
The error is
validation error detected: Value '[subnet-aaaaaa,subnet-bbbbb,subnet-cccccc]' at 'vpcConfig.subnetIds' failed to satisfy constraint:
Upvotes: 1
Views: 141