0
votes

I have a AWS CodePipeline to deploy a stack in CloudFormation using a YAML template as well as a template configuration JSON file.

Relevant Template Snippet:

AWSTemplateFormatVersion: '2010-09-09'
...
Parameters:
  subnetIds:
    Type: List<AWS::EC2::Subnet::Id>
...

Relevant Configuration File Snippet:

{
    "Parameters": {
      ...
      "subnetIds": [
        "subnet-a",
        "subnet-b",
        "subnet-c"
      ]
    },
    ...
}

For some reason the Deploy stage (CloudFormation) keeps failing with Parameter [subnetIds] is invalid, so my question is how do I pass a list of subnetIds to the template from the configuration file?

1
The template state the value of an entry in the array should be like this: AWS::EC2::Subnet::I'd (the :: are a delimiter) but you are provide only 1 string valueTamir Klein
You might like to amend your question to be explicit that you are using AWS CodePipeline. I have inferred that from the format of the template you mentioned.Alex Harvey

1 Answers

2
votes

It is explained here in the docs about list data types, such as:

List<AWS::EC2::Subnet::Id>

An array of subnet IDs, such as subnet-123a351e, subnet-456b351e.

That is to say, all List types in CloudFormation are also comma-separated strings.

Since you are using a CodePipeline Template Configuration File, you will have something like:

{
  "Parameters": {
    "subnetIds": "subnet-a,subnet-b,subnet-c"
  }
}