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(servicecatalogappregistry): Allow user to control stack id via stack name for Application stack #24171

Merged
merged 4 commits into from
Feb 16, 2023
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 @@ -10,8 +10,8 @@ export interface TargetApplicationCommonOptions extends cdk.StackProps {
* Stack ID in which application will be created or imported. The id of a stack is also the identifier that you use to
* refer to it in the [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/cli.html).
*
* @default - ApplicationAssociatorStack
* @deprecated - Use `stackName` instead to control the name of the stack
* @default - The value of `stackName` will be used as stack id
* @deprecated - Use `stackName` instead to control the name and id of the stack
*/
readonly stackId?: string;
}
Expand Down Expand Up @@ -91,9 +91,9 @@ class CreateTargetApplication extends TargetApplication {
super();
}
public bind(scope: Construct): BindTargetApplicationResult {
const stackId = this.applicationOptions.stackId ?? 'ApplicationAssociatorStack';
(this.applicationOptions.stackName as string) =
this.applicationOptions.stackName || `Application-${this.applicationOptions.applicationName}-Stack`;
const stackId = this.applicationOptions.stackName;
(this.applicationOptions.description as string) =
this.applicationOptions.description || 'Stack to create AppRegistry application';
(this.applicationOptions.env as cdk.Environment) =
Expand Down Expand Up @@ -122,9 +122,9 @@ class ExistingTargetApplication extends TargetApplication {
public bind(scope: Construct): BindTargetApplicationResult {
const arnComponents = cdk.Arn.split(this.applicationOptions.applicationArnValue, cdk.ArnFormat.SLASH_RESOURCE_SLASH_RESOURCE_NAME);
const applicationId = arnComponents.resourceName;
const stackId = this.applicationOptions.stackId ?? 'ApplicationAssociatorStack';
(this.applicationOptions.stackName as string) =
this.applicationOptions.stackName || `Application-${applicationId}-Stack`;
const stackId = this.applicationOptions.stackName;
const applicationStack = new cdk.Stack(scope, stackId, this.applicationOptions);
const appRegApplication = Application.fromApplicationArn(applicationStack, 'ExistingApplication', this.applicationOptions.applicationArnValue);
return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": "29.0.0",
"version": "30.0.0",
"files": {
"c4d674e9642d6dbbd0df5c93890473101fc95bbc70de7e28d79ba771b5284de8": {
"source": {
"path": "ApplicationAssociatorStack.template.json",
"path": "Application-AppRegistryAssociatedApplication-Stack.template.json",
"packaging": "file"
},
"destinations": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"files": {
"19dd33f3c17e59cafd22b9459b0a8d9bedbd42252737fedb06b2bcdbcf7809cc": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"30.0.0"}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"files": {
"19dd33f3c17e59cafd22b9459b0a8d9bedbd42252737fedb06b2bcdbcf7809cc": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"testCases": {
"ApplicationAssociatorTest/DefaultTest": {
"stacks": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"files": {
"19dd33f3c17e59cafd22b9459b0a8d9bedbd42252737fedb06b2bcdbcf7809cc": {
"source": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "29.0.0",
"version": "30.0.0",
"artifacts": {
"integservicecatalogappregistryapplicationresourcesStack4399A149.assets": {
"type": "cdk:asset-manifest",
Expand Down Expand Up @@ -30,7 +30,7 @@
}
},
"dependencies": [
"ApplicationAssociatorStack",
"Application-AppRegistryAssociatedApplication-Stack",
"integservicecatalogappregistryapplicationresourcesStack4399A149.assets"
],
"metadata": {
Expand Down Expand Up @@ -94,7 +94,7 @@
}
},
"dependencies": [
"ApplicationAssociatorStack",
"Application-AppRegistryAssociatedApplication-Stack",
"integ-servicecatalogappregistry-application.assets"
],
"metadata": {
Expand Down Expand Up @@ -129,71 +129,70 @@
},
"displayName": "integ-servicecatalogappregistry-application"
},
"ApplicationAssociatorStack.assets": {
"Application-AppRegistryAssociatedApplication-Stack.assets": {
"type": "cdk:asset-manifest",
"properties": {
"file": "ApplicationAssociatorStack.assets.json",
"file": "Application-AppRegistryAssociatedApplication-Stack.assets.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
}
},
"ApplicationAssociatorStack": {
"Application-AppRegistryAssociatedApplication-Stack": {
"type": "aws:cloudformation:stack",
"environment": "aws://416623072619/us-east-1",
"properties": {
"templateFile": "ApplicationAssociatorStack.template.json",
"templateFile": "Application-AppRegistryAssociatedApplication-Stack.template.json",
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::416623072619:role/cdk-hnb659fds-deploy-role-416623072619-us-east-1",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::416623072619:role/cdk-hnb659fds-cfn-exec-role-416623072619-us-east-1",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-416623072619-us-east-1/c4d674e9642d6dbbd0df5c93890473101fc95bbc70de7e28d79ba771b5284de8.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
"ApplicationAssociatorStack.assets"
"Application-AppRegistryAssociatedApplication-Stack.assets"
],
"lookupRole": {
"arn": "arn:${AWS::Partition}:iam::416623072619:role/cdk-hnb659fds-lookup-role-416623072619-us-east-1",
"requiresBootstrapStackVersion": 8,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
},
"stackName": "Application-AppRegistryAssociatedApplication-Stack"
}
},
"dependencies": [
"ApplicationAssociatorStack.assets"
"Application-AppRegistryAssociatedApplication-Stack.assets"
],
"metadata": {
"/ApplicationAssociatorStack/DefaultCdkApplication/Resource": [
"/Application-AppRegistryAssociatedApplication-Stack/DefaultCdkApplication/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "DefaultCdkApplication4573D5A3"
}
],
"/ApplicationAssociatorStack/DefaultCdkApplication/ApplicationManagerUrl": [
"/Application-AppRegistryAssociatedApplication-Stack/DefaultCdkApplication/ApplicationManagerUrl": [
{
"type": "aws:cdk:logicalId",
"data": "DefaultCdkApplicationApplicationManagerUrl27C138EF"
}
],
"/ApplicationAssociatorStack/AppRegistryAssociation": [
"/Application-AppRegistryAssociatedApplication-Stack/AppRegistryAssociation": [
{
"type": "aws:cdk:logicalId",
"data": "AppRegistryAssociation"
}
],
"/ApplicationAssociatorStack/BootstrapVersion": [
"/Application-AppRegistryAssociatedApplication-Stack/BootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "BootstrapVersion"
}
],
"/ApplicationAssociatorStack/CheckBootstrapVersion": [
"/Application-AppRegistryAssociatedApplication-Stack/CheckBootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "CheckBootstrapVersion"
}
]
},
"displayName": "ApplicationAssociatorStack"
"displayName": "Application-AppRegistryAssociatedApplication-Stack"
},
"ApplicationAssociatorTestDefaultTestDeployAssert2A5F2DB9.assets": {
"type": "cdk:asset-manifest",
Expand Down Expand Up @@ -224,7 +223,7 @@
}
},
"dependencies": [
"ApplicationAssociatorStack",
"Application-AppRegistryAssociatedApplication-Stack",
"ApplicationAssociatorTestDefaultTestDeployAssert2A5F2DB9.assets"
],
"metadata": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@
"version": "0.0.0"
}
},
"ApplicationAssociatorStack": {
"id": "ApplicationAssociatorStack",
"path": "ApplicationAssociatorStack",
"Application-AppRegistryAssociatedApplication-Stack": {
"id": "Application-AppRegistryAssociatedApplication-Stack",
"path": "Application-AppRegistryAssociatedApplication-Stack",
"children": {
"DefaultCdkApplication": {
"id": "DefaultCdkApplication",
"path": "ApplicationAssociatorStack/DefaultCdkApplication",
"path": "Application-AppRegistryAssociatedApplication-Stack/DefaultCdkApplication",
"children": {
"Resource": {
"id": "Resource",
"path": "ApplicationAssociatorStack/DefaultCdkApplication/Resource",
"path": "Application-AppRegistryAssociatedApplication-Stack/DefaultCdkApplication/Resource",
"attributes": {
"aws:cdk:cloudformation:type": "AWS::ServiceCatalogAppRegistry::Application",
"aws:cdk:cloudformation:props": {
Expand All @@ -128,7 +128,7 @@
},
"ApplicationManagerUrl": {
"id": "ApplicationManagerUrl",
"path": "ApplicationAssociatorStack/DefaultCdkApplication/ApplicationManagerUrl",
"path": "Application-AppRegistryAssociatedApplication-Stack/DefaultCdkApplication/ApplicationManagerUrl",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnOutput",
"version": "0.0.0"
Expand All @@ -142,7 +142,7 @@
},
"AppRegistryAssociation": {
"id": "AppRegistryAssociation",
"path": "ApplicationAssociatorStack/AppRegistryAssociation",
"path": "Application-AppRegistryAssociatedApplication-Stack/AppRegistryAssociation",
"attributes": {
"aws:cdk:cloudformation:type": "AWS::ServiceCatalogAppRegistry::ResourceAssociation",
"aws:cdk:cloudformation:props": {
Expand All @@ -165,15 +165,15 @@
},
"BootstrapVersion": {
"id": "BootstrapVersion",
"path": "ApplicationAssociatorStack/BootstrapVersion",
"path": "Application-AppRegistryAssociatedApplication-Stack/BootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnParameter",
"version": "0.0.0"
}
},
"CheckBootstrapVersion": {
"id": "CheckBootstrapVersion",
"path": "ApplicationAssociatorStack/CheckBootstrapVersion",
"path": "Application-AppRegistryAssociatedApplication-Stack/CheckBootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnRule",
"version": "0.0.0"
Expand Down

This file was deleted.