-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/diff-no-fallback-app/app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const cdk = require('aws-cdk-lib'); | ||
const sns = require('aws-cdk-lib/aws-sns'); | ||
/** | ||
* This stack will be deployed in multiple phases, to achieve a very specific effect | ||
* | ||
* - Deploy Phase: a stack is deployed with an output set to a static string | ||
* - Diff Phase: a reference to a non-existing macro is used for the output value | ||
* | ||
* To exercise this app: | ||
* | ||
* ``` | ||
* npx cdk deploy | ||
* env DIFF_PHASE=on npx cdk diff --no-fallback | ||
* # This will surface an error to the user about the missing macro | ||
* ``` | ||
*/ | ||
class DiffNoFallbackTestStack extends cdk.Stack { | ||
constructor(scope, id, props) { | ||
super(scope, id, props); | ||
|
||
// Have at least one resource so that we can deploy this | ||
new sns.Topic(this, 'topic', { | ||
removalPolicy: cdk.RemovalPolicy.DESTROY, | ||
}); | ||
|
||
const outputValue = process.env.DIFF_PHASE ? cdk.Fn.transform('NonExisting', { Param: 'Value' }) : 'static-string' | ||
|
||
new cdk.CfnOutput(this, 'MyOutput', { | ||
value: outputValue | ||
}) | ||
} | ||
} | ||
const stackPrefix = process.env.STACK_NAME_PREFIX; | ||
const app = new cdk.App(); | ||
|
||
new DiffNoFallbackTestStack(app, `${stackPrefix}-test-diff-no-fallback`); | ||
|
||
app.synth(); |
4 changes: 4 additions & 0 deletions
4
packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/diff-no-fallback-app/cdk.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"app": "node app.js", | ||
"versionReporting": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters