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): creating ApplicationStack in AppScope to give user more control over the passed stackId #22977

Merged
merged 5 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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 @@ -42,7 +42,7 @@ export class ApplicationAssociator extends Construct {
}

const targetApplication = props.applications[0];
this.application = targetApplication.bind(this).application;
this.application = targetApplication.bind(scope).application;
cdk.Aspects.of(scope).add(new CheckedStageStackAssociator(this));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { IApplication, Application } from './application';
*/
export interface TargetApplicationCommonOptions extends cdk.StackProps {
/**
* Stack ID in which application will be created or imported.
* 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 {@link https://docs.aws.amazon.com/cdk/v2/guide/cli.html | AWS CDK Toolkit (cdk command)}.
*
* @default - ApplicationAssociatorStack
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{
"version": "21.0.0",
"files": {
"4285054f947789e255e76c75b889b3b216adabb0b3f990c8966c18459cdf7b35": {
"096a2ebc1093f405e713a82ffa6755ace9d5244a06f746653f025546795d3a0a": {
"source": {
"path": "ApplicationAssociatorStack.template.json",
"path": "AppRegistryApplicationStack.template.json",
"packaging": "file"
},
"destinations": {
"current_account-current_region": {
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
"objectKey": "4285054f947789e255e76c75b889b3b216adabb0b3f990c8966c18459cdf7b35.json",
"objectKey": "096a2ebc1093f405e713a82ffa6755ace9d5244a06f746653f025546795d3a0a.json",
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"Description": "Stack that holds the AppRegistryAssociatedApplication application",
"Resources": {
"DefaultCdkApplication4573D5A3": {
"Type": "AWS::ServiceCatalogAppRegistry::Application",
"Properties": {
"Name": "AppRegistryAssociatedApplication",
"Description": "Testing AppRegistry ApplicationAssociator"
"Description": "Application containing stacks deployed via CDK."
}
},
"AppRegistryAssociation": {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"version": "21.0.0",
"artifacts": {
"Tree": {
"type": "cdk:tree",
"properties": {
"file": "tree.json"
}
},
"integservicecatalogappregistryapplicationresourcesStack4399A149.assets": {
"type": "cdk:asset-manifest",
"properties": {
Expand Down Expand Up @@ -36,7 +30,7 @@
}
},
"dependencies": [
"ApplicationAssociatorStack",
"AppRegistryApplicationStack",
"integservicecatalogappregistryapplicationresourcesStack4399A149.assets"
],
"metadata": {
Expand Down Expand Up @@ -100,7 +94,7 @@
}
},
"dependencies": [
"ApplicationAssociatorStack",
"AppRegistryApplicationStack",
"integ-servicecatalogappregistry-application.assets"
],
"metadata": {
Expand Down Expand Up @@ -135,27 +129,27 @@
},
"displayName": "integ-servicecatalogappregistry-application"
},
"ApplicationAssociatorStack.assets": {
"AppRegistryApplicationStack.assets": {
"type": "cdk:asset-manifest",
"properties": {
"file": "ApplicationAssociatorStack.assets.json",
"file": "AppRegistryApplicationStack.assets.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version"
}
},
"ApplicationAssociatorStack": {
"AppRegistryApplicationStack": {
"type": "aws:cloudformation:stack",
"environment": "aws://unknown-account/unknown-region",
"properties": {
"templateFile": "ApplicationAssociatorStack.template.json",
"templateFile": "AppRegistryApplicationStack.template.json",
"validateOnSynth": false,
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4285054f947789e255e76c75b889b3b216adabb0b3f990c8966c18459cdf7b35.json",
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/096a2ebc1093f405e713a82ffa6755ace9d5244a06f746653f025546795d3a0a.json",
"requiresBootstrapStackVersion": 6,
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
"additionalDependencies": [
"ApplicationAssociatorStack.assets"
"AppRegistryApplicationStack.assets"
],
"lookupRole": {
"arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}",
Expand All @@ -165,10 +159,10 @@
"stackName": "AppRegistryApplicationAssociatorStack"
},
"dependencies": [
"ApplicationAssociatorStack.assets"
"AppRegistryApplicationStack.assets"
],
"metadata": {
"/ApplicationAssociatorStack": [
"/AppRegistryApplicationStack": [
{
"type": "aws:cdk:warning",
"data": "Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack."
Expand All @@ -178,32 +172,38 @@
"data": "Environment agnostic stack determined, AppRegistry association might not work as expected in case you deploy cross-region or cross-account stack."
}
],
"/ApplicationAssociatorStack/DefaultCdkApplication/Resource": [
"/AppRegistryApplicationStack/DefaultCdkApplication/Resource": [
{
"type": "aws:cdk:logicalId",
"data": "DefaultCdkApplication4573D5A3"
}
],
"/ApplicationAssociatorStack/AppRegistryAssociation": [
"/AppRegistryApplicationStack/AppRegistryAssociation": [
{
"type": "aws:cdk:logicalId",
"data": "AppRegistryAssociation"
}
],
"/ApplicationAssociatorStack/BootstrapVersion": [
"/AppRegistryApplicationStack/BootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "BootstrapVersion"
}
],
"/ApplicationAssociatorStack/CheckBootstrapVersion": [
"/AppRegistryApplicationStack/CheckBootstrapVersion": [
{
"type": "aws:cdk:logicalId",
"data": "CheckBootstrapVersion"
}
]
},
"displayName": "ApplicationAssociatorStack"
"displayName": "AppRegistryApplicationStack"
},
"Tree": {
"type": "cdk:tree",
"properties": {
"file": "tree.json"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
"id": "App",
"path": "",
"children": {
"Tree": {
"id": "Tree",
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.95"
}
},
"integ-servicecatalogappregistry-application": {
"id": "integ-servicecatalogappregistry-application",
"path": "integ-servicecatalogappregistry-application",
Expand All @@ -37,6 +29,22 @@
"fqn": "@aws-cdk/aws-servicecatalogappregistry.CfnResourceAssociation",
"version": "0.0.0"
}
},
"BootstrapVersion": {
"id": "BootstrapVersion",
"path": "integ-servicecatalogappregistry-application/resourcesStack/BootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnParameter",
"version": "0.0.0"
}
},
"CheckBootstrapVersion": {
"id": "CheckBootstrapVersion",
"path": "integ-servicecatalogappregistry-application/resourcesStack/CheckBootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnRule",
"version": "0.0.0"
}
}
},
"constructInfo": {
Expand All @@ -61,6 +69,22 @@
"fqn": "@aws-cdk/aws-servicecatalogappregistry.CfnResourceAssociation",
"version": "0.0.0"
}
},
"BootstrapVersion": {
"id": "BootstrapVersion",
"path": "integ-servicecatalogappregistry-application/BootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnParameter",
"version": "0.0.0"
}
},
"CheckBootstrapVersion": {
"id": "CheckBootstrapVersion",
"path": "integ-servicecatalogappregistry-application/CheckBootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnRule",
"version": "0.0.0"
}
}
},
"constructInfo": {
Expand All @@ -76,22 +100,22 @@
"version": "0.0.0"
}
},
"ApplicationAssociatorStack": {
"id": "ApplicationAssociatorStack",
"path": "ApplicationAssociatorStack",
"AppRegistryApplicationStack": {
"id": "AppRegistryApplicationStack",
"path": "AppRegistryApplicationStack",
"children": {
"DefaultCdkApplication": {
"id": "DefaultCdkApplication",
"path": "ApplicationAssociatorStack/DefaultCdkApplication",
"path": "AppRegistryApplicationStack/DefaultCdkApplication",
"children": {
"Resource": {
"id": "Resource",
"path": "ApplicationAssociatorStack/DefaultCdkApplication/Resource",
"path": "AppRegistryApplicationStack/DefaultCdkApplication/Resource",
"attributes": {
"aws:cdk:cloudformation:type": "AWS::ServiceCatalogAppRegistry::Application",
"aws:cdk:cloudformation:props": {
"name": "AppRegistryAssociatedApplication",
"description": "Testing AppRegistry ApplicationAssociator"
"description": "Application containing stacks deployed via CDK."
}
},
"constructInfo": {
Expand All @@ -107,7 +131,7 @@
},
"AppRegistryAssociation": {
"id": "AppRegistryAssociation",
"path": "ApplicationAssociatorStack/AppRegistryAssociation",
"path": "AppRegistryApplicationStack/AppRegistryAssociation",
"attributes": {
"aws:cdk:cloudformation:type": "AWS::ServiceCatalogAppRegistry::ResourceAssociation",
"aws:cdk:cloudformation:props": {
Expand All @@ -127,12 +151,36 @@
"fqn": "@aws-cdk/aws-servicecatalogappregistry.CfnResourceAssociation",
"version": "0.0.0"
}
},
"BootstrapVersion": {
"id": "BootstrapVersion",
"path": "AppRegistryApplicationStack/BootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnParameter",
"version": "0.0.0"
}
},
"CheckBootstrapVersion": {
"id": "CheckBootstrapVersion",
"path": "AppRegistryApplicationStack/CheckBootstrapVersion",
"constructInfo": {
"fqn": "@aws-cdk/core.CfnRule",
"version": "0.0.0"
}
}
},
"constructInfo": {
"fqn": "@aws-cdk/core.Stack",
"version": "0.0.0"
}
},
"Tree": {
"id": "Tree",
"path": "Tree",
"constructInfo": {
"fqn": "constructs.Construct",
"version": "10.1.161"
}
}
},
"constructInfo": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ new appreg.ApplicationAssociator(app, 'RegisterCdkApplication', {
applications: [appreg.TargetApplication.createApplicationStack({
applicationName: 'AppRegistryAssociatedApplication',
stackName: 'AppRegistryApplicationAssociatorStack',
stackId: 'AppRegistryApplicationStack',
})],
});

Expand Down