Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to generate correct parameter overrides #566

Closed
mindstorms6 opened this issue Aug 14, 2018 · 1 comment · Fixed by #574
Closed

Impossible to generate correct parameter overrides #566

mindstorms6 opened this issue Aug 14, 2018 · 1 comment · Fixed by #574

Comments

@mindstorms6
Copy link
Contributor

mindstorms6 commented Aug 14, 2018

(TIL enter creates the issue! - actual issue incoming)

When creating a code pipeline with a CloudFormation action - we have a handy prop called paramterOverrides which takes { [name: string]: any };. Customers would use this to feed parameter configuration to a CloudFormation action when not using a template configuration file.

The correct configuration for this value is a JSON object (string):

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/continuous-delivery-codepipeline-action-reference.html

(Shamelessly stolen from this example: https://github.com/quarryman/AWSfrontendCI/blob/2dab0c0e4424258f9c5864885d5dfc6498dd080b/serverless-pipeline.yaml#L217 )

Configuration: 
                ActionMode: CHANGE_SET_REPLACE
                Capabilities: CAPABILITY_IAM
                ChangeSetName: !Sub '${ServiceName}-ChangeSet-Beta'
                ParameterOverrides: "{ \"SourceBucket\" : { \"Fn::GetArtifactAtt\" : [\"BetaBuiltZip\", \"BucketName\"]}, \"SourceArtifact\" : { \"Fn::GetArtifactAtt\" : [\"BetaBuiltZip\", \"ObjectKey\"]} }"
                RoleArn: !GetAtt CloudFormationExecutionRole.Arn
                StackName: !Sub '${ServiceName}-Stack-Beta'
                TemplatePath: !Sub 'BetaBuiltZip::app-output_sam.yaml'

However, we generate an object:

ParameterOverrides:
  CodeBuildBucket: {"Fn::GetArtifactAtt":["BuildOutput","BucketName"]}
  CodeBuildKey: {"Fn::GetArtifactAtt":["BuildOutput","ObjectKey"]}

I believe we just need to call JSON.stringify() the passed values.

@eladb
Copy link
Contributor

eladb commented Aug 14, 2018

@rix0rrr is actually working on a nifty utility function in #518 (CloudFormationJson.stringify) which can be used exactly for that purpose

rix0rrr pushed a commit that referenced this issue Aug 15, 2018
ParameterOverrides needs to be a JSON-encoded object, not an object
itself.

Fixes #566.
rix0rrr added a commit that referenced this issue Aug 15, 2018
ParameterOverrides needs to be a JSON-encoded object, not an object
itself.

Fixes #566.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants