Eric Nord
Eric Nord

Reputation: 4885

CodePipeline CloudFormation Template configuration

I'm trying to use the CloudFormation Template configuration field in a CodePipeline. If you edit the CloudFormation in CodePipeline it looks like this:

enter image description here

If my InputArtifactName is MyAppBuild and I have a CloudFormation config file in cfg-prd.json, my hope was I could enter MyAppBuild::cfg-prd.json and have it pick it up.

I get an error about the template file not being valid even though it works manually as:

--parameters cfg-prd.json

Upvotes: 10

Views: 9342

Answers (2)

hynespm
hynespm

Reputation: 671

A nice trick to see what the Cloudformation layout should be is to create a pipeline which you know will work. Then use the CLI to extract a cloudformation template.

aws codepipeline get-pipeline --name <pipelinename>

You will get the JSON of the Codepipeline resource. There will be a few changes required but from this you can see exactly what the syntax should be and from there parameterised your template and create Codepipelines programatically.

Upvotes: 10

wjordan
wjordan

Reputation: 20380

Note that the Template Configuration File has a different JSON structure than the format accepted by the --parameters option to aws cloudformation create-stack:

{
  "Parameters" : {
    "NameOfTemplateParameter" : "ValueOfParameter",
    ...
  },
  "StackPolicy" : {
    "Statement" : [
      StackPolicyStatement
    ]
  }
}

Upvotes: 18

Related Questions