aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

[aws-codepipeline] Parameter overrides cannot use Fn::If

Open kjenney opened this issue 7 years ago • 5 comments

Describe the bug I'm trying to create optional parameter overrides for my CodePipeline but it's failing with:

Template Error: Encountered unsupported function: Fn::GetParam Supported functions are: [Fn::Base64, Fn::GetAtt, Fn::GetAZs, Fn::ImportValue, Fn::Join, Fn::Split, Fn::FindInMap, Fn::Select, Ref, Fn::Equals, Fn::If, Fn::Not, Condition, Fn::And, Fn::Or, Fn::Contains, Fn::EachMemberEquals, Fn::EachMemberIn, Fn::ValueOf, Fn::ValueOfAll, Fn::RefAll, Fn::Sub, Fn::Cidr]

To Reproduce

ParameterOverrides:
   Fn::If: [
     IsECS,
     {
        "ImageVersion" : { "Fn::GetParam" : ["BuildArtifact", "version.json", "version"]}
     },
     !Ref "AWS::NoValue"
   ]

Expected behavior When IsECS is evaluated as True ImageVersion should be set to the value defined in version.js in the BuildArtifact. When IsECS is evaluated as False no ParameterOverrides are set.

Version:

  • OS - MacOS
  • Programming Language - Python/AWS CLI
  • CDK Version - NA

kjenney avatar May 10 '19 14:05 kjenney

Hello -

To help us reproduce and debug this, can you provide us with more information -

  1. A more complete CDK app code that causes this error, so we can the rest of the pieces.
  2. The command that generates this error. Ex: is it cdk synth or cdk deploy

Thanks.

nija-at avatar Aug 23 '19 10:08 nija-at

Hi @kjenney, checking to see if you saw the above comment. If you still want us to investigate this, please do provide us more information as noted above, otherwise I will be closing this issue shortly.

SomayaB avatar Sep 11 '19 00:09 SomayaB

Closing this issue since there hasn't been any activity on it in a while. Feel free to reopen.

SomayaB avatar Sep 17 '19 17:09 SomayaB

@SomayaB, this seems to still be a bug on 1.68.0 (build a6a3f46). See below:

S3DeployAction.Builder.create() .actionName("Deploy") .extract(true) .input(cdktfBuildOutput) .bucket(deployBucket) .objectKey(buildOutput.getParam("config.json", "commitID"))) .build()

results in "Encountered unsupported function: Fn::GetParam" due to the getParam method on the Artifact.

lukepopp avatar Oct 20 '20 04:10 lukepopp

Not sure what you mean @lukepopp - the problem is you can't use Fn::GetParam in S3 Deploy action. You can only use Fn::GetParam in CloudFormation deployment actions, in the parameterOverrides property.

skinny85 avatar Oct 20 '20 15:10 skinny85