Search code examples
aws-codepipeline

AWS V2 CodePipeline complaining about variables


I have the following on my AWS CodePipeline Cloudformation template:

Variables:
    - Name: VARIABLE_NAME
      Description: Some description
      DefaultValue: ""
Version: 2

When I create the CodePipeline using Cloudformation, I get the following error:

Resource handler returned message: "Pipeline variable can only be used with V2 pipelines"

I am also getting the following error when I do it manually on the UI:

enter image description here

Any idea what I'm doing wrong or is it an AWS issue?


Solution

  • I'm not familiar with Cloudformation but when using terraform you can define the pipeline version using pipeline_type = "V2", so I'd assume it's the same for Cloudformation as well.

    According to the doc you should use PipelineType: "V2" instead of Version: 2.

    https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-codepipeline-pipeline.html#cfn-codepipeline-pipeline-pipelinetype