You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(servicecatalogappregistry-alpha): Introduce flag to control application sharing and association behavior for cross-account stacks (#24408)
Problem:
* Currently, the ApplicationAssociator construct automatically shares the target Application with any accounts of cross-account stacks. [[code reference](https://github.com/aws/aws-cdk/blob/main/packages/@aws-cdk/aws-servicecatalogappregistry/lib/aspects/stack-associator.ts#L91-L95)]
* If the owner of a cross-account stack is not part of the same AWS Organization as the owner of the ApplicationAssociator stack, or otherwise have not enabled cross-account sharing, during deployment the ApplicationAssociator will fail when attempting to share the application with the stack owner, with a message like below:
```
Principal 123456789012 is not in your AWS organization. You do not have permission to add external
AWS accounts to a resource share.
(Service: AWSRAM; Status Code: 400; Error Code: OperationNotPermittedException;
Request ID: aaa; Proxy: null)
```
Feature:
* We want to introduce a mechanism (`associateCrossAccountStacks` field in TargetApplicationOptions) where the user can specify if they want to allow sharing their application to any accounts of cross-account stacks in order to then subsequently associate the stack with the application.
* This flag will be `false` by default. This allows customers to have their stack deployments proceed without being blocked on application sharing or cross-account associations.
* If set to `false`, ApplicationAssociator will skip the application sharing and association for cross-account stacks. During synthesis, a warning will be displayed to notify that cross-account stacks were detected but sharing and association will be skipped.
* If set to `true`, the application will be shared and then associated for cross-account stacks. This relies on the user properly setting up cross-account sharing beforehand.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
this.warning(node,'Cross-account stack detected but application sharing and association will be skipped because cross-account option is not enabled.');
123
+
return;
124
+
}
98
125
}
99
126
}
100
127
}
@@ -103,8 +130,8 @@ export class CheckedStageStackAssociator extends StackAssociatorBase {
Annotations.fromStack(crossAccountStack).hasWarning('*','Cross-account stack detected but application sharing and association will be skipped because cross-account option is not enabled.');
195
+
});
196
+
197
+
test('ApplicationAssociator with cross account stacks inside cdkApp does not give warning if associateCrossAccountStacks is set to true',()=>{
Annotations.fromStack(crossAccountStack).hasNoWarning('*','Cross-account stack detected but application sharing and association will be skipped because cross-account option is not enabled.');
211
+
});
212
+
213
+
test('ApplicationAssociator with cross region stacks inside cdkApp gives warning',()=>{
0 commit comments