Skip to content

Commit c7a157d

Browse files
gsingh04dougtoppin
authored andcommitted
Use stack name in Service Catalog Application name for multiple cfn stack 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-*
1 parent 1e3f42c commit c7a157d

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- package-lock.json for all modules [#426](https://github.com/aws-solutions/serverless-image-handler/pull/426)
1313
- 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)
1414
- demo-ui unicode support [#416](https://github.com/aws-solutions/serverless-image-handler/issues/416)
15+
- support for multiple cloudformation stack deployments in the same region
1516

1617
### Changed
1718

source/constructs/lib/common-resources/common-resources-construct.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class CommonResources extends Construct {
9393
const applicationType = "AWS-Solutions";
9494

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

106106
const attributeGroup = new appreg.AttributeGroup(stack, "DefaultApplicationAttributes", {
107-
attributeGroupName: Aws.STACK_NAME,
107+
attributeGroupName: `AppRegistry-${Aws.STACK_NAME}`,
108108
description: "Attribute group for solution information",
109109
attributes: {
110110
applicationType,

source/constructs/test/__snapshots__/constructs.test.ts.snap

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,10 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
333333
"Fn::Join": [
334334
"-",
335335
[
336-
"sih",
336+
"AppRegistry",
337+
{
338+
"Ref": "AWS::StackName",
339+
},
337340
{
338341
"Ref": "AWS::Region",
339342
},
@@ -1823,7 +1826,15 @@ exports[`Serverless Image Handler Stack Snapshot 1`] = `
18231826
},
18241827
"Description": "Attribute group for solution information",
18251828
"Name": {
1826-
"Ref": "AWS::StackName",
1829+
"Fn::Join": [
1830+
"",
1831+
[
1832+
"AppRegistry-",
1833+
{
1834+
"Ref": "AWS::StackName",
1835+
},
1836+
],
1837+
],
18271838
},
18281839
"Tags": {
18291840
"SolutionId": "S0ABC",

0 commit comments

Comments
 (0)