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
fix(cli): diff with changeset fails if deploy role cannot be assumed (#29718)
Closes#29650
### Description of changes
This addresses the issue in two ways:
1. If the describeStacks call errors out, we now catch it and default to classic diff behavior.
2. The describeStacks call now tries to use the lookup role rather than the deploy role.
### Description of how you validated changes
Manual testing with a user that could only assume lookup roles.
### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
stream.write('Checking if the stack exists before creating the changeset has failed, will base the diff on template differences (run again with -v to see the reason)\n');
152
+
stackExists=false;
153
+
}
154
+
146
155
if(stackExists){
147
156
changeSet=awaitcreateDiffChangeSet({
148
157
stack: stacks.firstStack,
@@ -154,7 +163,7 @@ export class CdkToolkit {
154
163
stream,
155
164
});
156
165
}else{
157
-
debug(`the stack '${stacks.firstStack.stackName}' has not been deployed to CloudFormation, skipping changeset creation.`);
166
+
debug(`the stack '${stacks.firstStack.stackName}' has not been deployed to CloudFormation or describeStacks call failed, skipping changeset creation.`);
158
167
}
159
168
}
160
169
@@ -183,11 +192,20 @@ export class CdkToolkit {
183
192
letchangeSet=undefined;
184
193
185
194
if(options.changeSet){
186
-
// only perform this check if we're going to make a changeset. This check requires permissions that --no-changeset users might not have.
stream.write('Checking if the stack exists before creating the changeset has failed, will base the diff on template differences (run again with -v to see the reason)\n');
206
+
stackExists=false;
207
+
}
208
+
191
209
if(stackExists){
192
210
changeSet=awaitcreateDiffChangeSet({
193
211
stack,
@@ -200,7 +218,7 @@ export class CdkToolkit {
200
218
stream,
201
219
});
202
220
}else{
203
-
debug(`the stack '${stack.stackName}' has not been deployed to CloudFormation, skipping changeset creation.`);
221
+
debug(`the stack '${stack.stackName}' has not been deployed to CloudFormation or describeStacks call failed, skipping changeset creation.`);
0 commit comments