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

fix(aws-cloudformation): Fix ParameterOverrides #574

Merged
merged 1 commit into from
Aug 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export abstract class CloudFormationDeploymentAction extends CloudFormationActio
// This must be a string, so flatten the list to a comma-separated string.
Capabilities: (capabilities && capabilities.join(',')) || undefined,
RoleArn: new cdk.Token(() => this.role.roleArn),
ParameterOverrides: props.parameterOverrides,
ParameterOverrides: cdk.CloudFormationJSON.stringify(props.parameterOverrides),
TemplateConfiguration: props.templateConfiguration ? props.templateConfiguration.location : undefined,
StackName: props.stackName,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,45 @@ export = {

test.done();
},

'parameterOverrides are serialized as a string'(test: Test) {
// GIVEN
const stack = new TestFixture();

// WHEN
new CreateUpdateStack(stack, 'CreateUpdate', {
stage: stack.deployStage,
stackName: 'MyStack',
templatePath: stack.source.artifact.subartifact('template.yaml'),
parameterOverrides: {
RepoName: stack.repo.repositoryName
}
});

// THEN
expect(stack).to(haveResource('AWS::CodePipeline::Pipeline', {
"Stages": [
{ "Name": "Source" /* don't care about the rest */ },
{
"Name": "Deploy",
"Actions": [
{
"Configuration": {
"ParameterOverrides": { "Fn::Join": [ "", [
"{\"RepoName\":\"",
{ "Fn::GetAtt": [ "MyVeryImportantRepo11BC3EBD", "Name" ] },
"\"}"
]]}
},
"Name": "CreateUpdate",
},
],
}
]
}));

test.done();
}
};

/**
Expand Down