Skip to content

Commit

Permalink
Use stack name in Service Catalog Application name for multiple cfn s…
Browse files Browse the repository at this point in the history
…tack deployments (#438)

* Add stack name to service catalog application

This allows multiple stack deployments in the same account, region

* Update cdk snapshot

* Add changelog entry

* Prepend AppRegistry application name with static name

Stack name is used in naming AppRegistry application and attribute group; which must not begin with aws.
The change adds support for stack names starting with aws-*
  • Loading branch information
gsingh04 authored and dougtoppin committed Feb 7, 2023
1 parent 1e3f42c commit c7a157d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- package-lock.json for all modules [#426](https://github.com/aws-solutions/serverless-image-handler/pull/426)
- github workflows for running unit test, eslint and prettier formatting, cdk nag, security scans [#402](https://github.com/aws-solutions/serverless-image-handler/pull/402)
- demo-ui unicode support [#416](https://github.com/aws-solutions/serverless-image-handler/issues/416)
- support for multiple cloudformation stack deployments in the same region

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class CommonResources extends Construct {
const applicationType = "AWS-Solutions";

const application = new appreg.Application(stack, "AppRegistry", {
applicationName: Fn.join("-", [props.applicationName, Aws.REGION, Aws.ACCOUNT_ID]),
applicationName: Fn.join("-", ["AppRegistry", Aws.STACK_NAME, Aws.REGION, Aws.ACCOUNT_ID]),
description: `Service Catalog application to track and manage all your resources for the solution ${props.applicationName}`,
});
application.associateStack(stack);
Expand All @@ -104,7 +104,7 @@ export class CommonResources extends Construct {
Tags.of(application).add("Solutions:ApplicationType", applicationType);

const attributeGroup = new appreg.AttributeGroup(stack, "DefaultApplicationAttributes", {
attributeGroupName: Aws.STACK_NAME,
attributeGroupName: `AppRegistry-${Aws.STACK_NAME}`,
description: "Attribute group for solution information",
attributes: {
applicationType,
Expand Down
15 changes: 13 additions & 2 deletions source/constructs/test/__snapshots__/constructs.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,10 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
"Fn::Join": [
"-",
[
"sih",
"AppRegistry",
{
"Ref": "AWS::StackName",
},
{
"Ref": "AWS::Region",
},
Expand Down Expand Up @@ -1823,7 +1826,15 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
},
"Description": "Attribute group for solution information",
"Name": {
"Ref": "AWS::StackName",
"Fn::Join": [
"",
[
"AppRegistry-",
{
"Ref": "AWS::StackName",
},
],
],
},
"Tags": {
"SolutionId": "S0ABC",
Expand Down

0 comments on commit c7a157d

Please sign in to comment.