aws-cdk 2.1020.2 → 2.1022.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +100 -55
  2. package/THIRD_PARTY_LICENSES +65 -65
  3. package/build-info.json +2 -2
  4. package/db.json.gz +0 -0
  5. package/lib/api/refactor.d.ts +1 -0
  6. package/lib/api/refactor.js +8 -0
  7. package/lib/cli/cdk-toolkit.d.ts +19 -21
  8. package/lib/cli/cdk-toolkit.js +145 -141
  9. package/lib/cli/cli-config.js +19 -13
  10. package/lib/cli/cli-type-registry.json +29 -12
  11. package/lib/cli/cli.js +76 -22
  12. package/lib/cli/convert-to-user-input.js +16 -6
  13. package/lib/cli/display-version.d.ts +11 -0
  14. package/lib/cli/display-version.js +101 -0
  15. package/lib/cli/io-host/cli-io-host.d.ts +11 -11
  16. package/lib/cli/io-host/cli-io-host.js +68 -24
  17. package/lib/cli/parse-command-line-arguments.js +29 -11
  18. package/lib/cli/platform-warnings.d.ts +2 -1
  19. package/lib/cli/platform-warnings.js +3 -4
  20. package/lib/cli/telemetry/collect-telemetry.d.ts +5 -0
  21. package/lib/cli/telemetry/collect-telemetry.js +15 -0
  22. package/lib/cli/telemetry/endpoint-sink.d.ts +1 -2
  23. package/lib/cli/telemetry/endpoint-sink.js +4 -3
  24. package/lib/cli/telemetry/error.d.ts +2 -0
  25. package/lib/cli/telemetry/error.js +16 -0
  26. package/lib/cli/telemetry/feature-flags.d.ts +96 -0
  27. package/lib/cli/telemetry/feature-flags.js +103 -0
  28. package/lib/cli/telemetry/file-sink.js +8 -12
  29. package/lib/cli/telemetry/installation-id.d.ts +5 -0
  30. package/lib/cli/telemetry/installation-id.js +47 -0
  31. package/lib/cli/telemetry/library-version.d.ts +2 -0
  32. package/lib/cli/telemetry/library-version.js +30 -0
  33. package/lib/cli/telemetry/messages.d.ts +40 -0
  34. package/lib/cli/telemetry/messages.js +65 -0
  35. package/lib/cli/telemetry/sanitation.d.ts +100 -0
  36. package/lib/cli/telemetry/sanitation.js +79 -0
  37. package/lib/cli/telemetry/schema.d.ts +47 -19
  38. package/lib/cli/telemetry/schema.js +10 -1
  39. package/lib/cli/telemetry/session.d.ts +33 -0
  40. package/lib/cli/telemetry/session.js +130 -0
  41. package/lib/cli/user-configuration.d.ts +14 -4
  42. package/lib/cli/user-configuration.js +42 -30
  43. package/lib/cli/user-input.d.ts +31 -13
  44. package/lib/cli/user-input.js +1 -1
  45. package/lib/cli/util/ci.d.ts +5 -0
  46. package/lib/cli/util/ci.js +11 -0
  47. package/lib/cli/util/yargs-helpers.d.ts +1 -1
  48. package/lib/cli/util/yargs-helpers.js +7 -7
  49. package/lib/cli/version.d.ts +2 -12
  50. package/lib/cli/version.js +5 -103
  51. package/lib/commands/context.d.ts +10 -5
  52. package/lib/commands/context.js +35 -35
  53. package/lib/commands/docs.d.ts +6 -1
  54. package/lib/commands/docs.js +20 -19
  55. package/lib/commands/doctor.d.ts +4 -1
  56. package/lib/commands/doctor.js +17 -17
  57. package/lib/commands/flags.d.ts +3 -0
  58. package/lib/commands/flags.js +43 -0
  59. package/lib/commands/init/init-hooks.d.ts +2 -1
  60. package/lib/commands/init/init-hooks.js +6 -6
  61. package/lib/commands/init/init.d.ts +4 -2
  62. package/lib/commands/init/init.js +56 -54
  63. package/lib/commands/init/os.d.ts +2 -1
  64. package/lib/commands/init/os.js +3 -4
  65. package/lib/commands/list-stacks.js +8 -2
  66. package/lib/commands/migrate.d.ts +6 -17
  67. package/lib/commands/migrate.js +28 -29
  68. package/lib/cxapp/cloud-assembly.js +1 -1
  69. package/lib/cxapp/cloud-executable.js +41 -26
  70. package/lib/index.d.ts +1 -1
  71. package/lib/index.js +46764 -31086
  72. package/lib/index_bg.wasm +0 -0
  73. package/lib/init-templates/.init-version.json +1 -1
  74. package/lib/init-templates/.recommended-feature-flags.json +1 -0
  75. package/lib/{legacy-aws-auth.d.ts → legacy/aws-auth.d.ts} +1 -1
  76. package/lib/legacy/aws-auth.js +47 -0
  77. package/lib/legacy/configuration.d.ts +82 -0
  78. package/lib/legacy/configuration.js +321 -0
  79. package/lib/legacy/index.d.ts +19 -0
  80. package/lib/{legacy-exports-source.js → legacy/index.js} +23 -23
  81. package/lib/{legacy-logging-source.d.ts → legacy/logging.d.ts} +50 -0
  82. package/lib/legacy/logging.js +154 -0
  83. package/lib/legacy/types.js +3 -0
  84. package/lib/legacy-exports.d.ts +4 -3
  85. package/lib/legacy-exports.js +4 -1
  86. package/package.json +15 -15
  87. package/lib/legacy-aws-auth.js +0 -47
  88. package/lib/legacy-exports-source.d.ts +0 -18
  89. package/lib/legacy-logging-source.js +0 -107
  90. package/lib/legacy-types.js +0 -3
  91. package/lib/logging.d.ts +0 -99
  92. package/lib/logging.js +0 -146
  93. /package/lib/{legacy-types.d.ts → legacy/types.d.ts} +0 -0
package/README.md CHANGED
@@ -11,26 +11,27 @@
11
11
 
12
12
  The AWS CDK Toolkit provides the `cdk` command-line interface that can be used to work with AWS CDK applications. This module is part of the [AWS Cloud Development Kit](https://github.com/aws/aws-cdk) project.
13
13
 
14
- | Command | Description |
15
- | ------------------------------------- | --------------------------------------------------------------------------------- |
16
- | [`cdk docs`](#cdk-docs) | Access the online documentation |
17
- | [`cdk init`](#cdk-init) | Start a new CDK project (app or library) |
18
- | [`cdk list`](#cdk-list) | List stacks and their dependencies in an application |
19
- | [`cdk synth`](#cdk-synth) | Synthesize a CDK app to CloudFormation template(s) |
20
- | [`cdk diff`](#cdk-diff) | Diff stacks against current state |
21
- | [`cdk deploy`](#cdk-deploy) | Deploy a stack into an AWS account |
22
- | [`cdk rollback`](#cdk-rollback) | Roll back a failed deployment |
23
- | [`cdk import`](#cdk-import) | Import existing AWS resources into a CDK stack |
24
- | [`cdk migrate`](#cdk-migrate) | Migrate AWS resources, CloudFormation stacks, and CloudFormation templates to CDK |
25
- | [`cdk watch`](#cdk-watch) | Watches a CDK app for deployable and hotswappable changes |
26
- | [`cdk destroy`](#cdk-destroy) | Deletes a stack from an AWS account |
27
- | [`cdk bootstrap`](#cdk-bootstrap) | Deploy a toolkit stack to support deploying large stacks & artifacts |
28
- | [`cdk gc`](#cdk-gc) | Garbage collect assets associated with the bootstrapped stack |
29
- | [`cdk doctor`](#cdk-doctor) | Inspect the environment and produce information useful for troubleshooting |
30
- | [`cdk acknowledge`](#cdk-acknowledge) | Acknowledge (and hide) a notice by issue number |
31
- | [`cdk notices`](#cdk-notices) | List all relevant notices for the application |
32
- | [`cdk refactor`](#cdk-refactor) | Moves resources between stacks or within the same stack |
33
- | [`cdk drift`](#cdk-drift) | Detect drifts in the given CloudFormation stack(s) |
14
+ | Command | Description |
15
+ | ---------------------------------------- | --------------------------------------------------------------------------------- |
16
+ | [`cdk docs`](#cdk-docs) | Access the online documentation |
17
+ | [`cdk init`](#cdk-init) | Start a new CDK project (app or library) |
18
+ | [`cdk list`](#cdk-list) | List stacks and their dependencies in an application |
19
+ | [`cdk synth`](#cdk-synth) | Synthesize a CDK app to CloudFormation template(s) |
20
+ | [`cdk diff`](#cdk-diff) | Diff stacks against current state |
21
+ | [`cdk deploy`](#cdk-deploy) | Deploy a stack into an AWS account |
22
+ | [`cdk rollback`](#cdk-rollback) | Roll back a failed deployment |
23
+ | [`cdk import`](#cdk-import) | Import existing AWS resources into a CDK stack |
24
+ | [`cdk migrate`](#cdk-migrate) | Migrate AWS resources, CloudFormation stacks, and CloudFormation templates to CDK |
25
+ | [`cdk watch`](#cdk-watch) | Watches a CDK app for deployable and hotswappable changes |
26
+ | [`cdk destroy`](#cdk-destroy) | Deletes a stack from an AWS account |
27
+ | [`cdk bootstrap`](#cdk-bootstrap) | Deploy a toolkit stack to support deploying large stacks & artifacts |
28
+ | [`cdk gc`](#cdk-gc) | Garbage collect assets associated with the bootstrapped stack |
29
+ | [`cdk doctor`](#cdk-doctor) | Inspect the environment and produce information useful for troubleshooting |
30
+ | [`cdk acknowledge`](#cdk-acknowledge) | Acknowledge (and hide) a notice by issue number |
31
+ | [`cdk notices`](#cdk-notices) | List all relevant notices for the application |
32
+ | [`cdk refactor`](#cdk-refactor) | Moves resources between stacks or within the same stack |
33
+ | [`cdk drift`](#cdk-drift) | Detect drifts in the given CloudFormation stack(s) |
34
+ | [`cdk cli-telemetry](#cdk-cli-telemetry) | Enable or disable cli telemetry collection |
34
35
 
35
36
  ## Common topics
36
37
 
@@ -1101,8 +1102,12 @@ when using this command.
1101
1102
 
1102
1103
  Compares the infrastructure specified in the current state of the CDK app with
1103
1104
  the currently deployed application, to determine if any resource was moved
1104
- (to a different stack or to a different logical ID, or both). The CLI will
1105
- show the correspondence between the old and new locations in a table:
1105
+ (to a different stack or to a different logical ID, or both). In keeping with
1106
+ the CloudFormation API, you are not allowed to modify the set of resources
1107
+ as part of a refactor. In other words, adding, deleting or updating resources
1108
+ is considered an error.
1109
+
1110
+ The CLI will show the correspondence between the old and new locations in a table:
1106
1111
 
1107
1112
  ```
1108
1113
  $ cdk refactor --unstable=refactor --dry-run
@@ -1125,41 +1130,45 @@ show this table and exit. Eventually, the CLI will also be able to automatically
1125
1130
  apply the refactor on your CloudFormation stacks. But for now, only the dry-run
1126
1131
  mode is supported.
1127
1132
 
1128
- If you want to exclude some resources from the refactor, you can pass an
1129
- exclude file, containing a list of destination locations to exclude. A
1130
- location can be either the stack name + logical ID, or the construct path. For
1131
- example, if you don't want to include the bucket and the distribution from
1132
- the table above in the refactor, you can create a file called
1133
- `exclude.txt` with the following content (destination locations separated by
1134
- newlines):
1133
+ If your application has more than one stack, and you want the `refactor`
1134
+ command to consider only a subset of them, you can pass a list of stack
1135
+ patterns as a parameter:
1135
1136
 
1137
+ ```shell
1138
+ $ cdk refactor Web* --unstable=refactor --dry-run
1136
1139
  ```
1137
- Web/Website/Origin/Resource
1138
- Web/Website/Distribution/Resource
1139
- ```
1140
1140
 
1141
- and pass it to the CLI via the `--exclude-file` flag:
1141
+ The pattern language is the same as the one used in the `cdk deploy` command.
1142
+ However, unlike `cdk deploy`, in the absence of this parameter, all stacks are
1143
+ considered.
1144
+
1145
+ The CLI's default behavior is to include in the comparison only the deployed
1146
+ stacks that have a counterpart (stack with the same name) locally. If you want
1147
+ to include additional deployed stacks in the comparison, pass their names using
1148
+ the `--additional-stack-name` option:
1142
1149
 
1143
1150
  ```shell
1144
- $ cdk refactor --exclude-file exclude.txt --unstable=refactor --dry-run
1151
+ $ cdk refactor --unstable=refactor --dry-run --additional-stack-name=Foo --additional-stack-name=Bar
1145
1152
  ```
1146
1153
 
1147
- If your application has more than one stack, and you want the refactor
1148
- command to consider only a subset of them, you can pass a list of stack
1149
- patterns as a parameter:
1154
+ In case of ambiguities, the CLI will display a table like this:
1150
1155
 
1151
- ```shell
1152
- $ cdk refactor Web* --unstable=refactor --dry-run
1156
+ ```
1157
+ Detected ambiguities:
1158
+ ┌───┬──────────────────────┐
1159
+ │ │ Resource │
1160
+ ├───┼──────────────────────┤
1161
+ │ - │ Stack2/DLQ/Resource │
1162
+ │ │ Stack2/DLQ2/Resource │
1163
+ ├───┼──────────────────────┤
1164
+ │ + │ Stack1/DLQ/Resource │
1165
+ │ │ Stack1/DLQ2/Resource │
1166
+ └───┴──────────────────────┘
1153
1167
  ```
1154
1168
 
1155
- The pattern language is the same as the one used in the `cdk deploy` command.
1156
- However, unlike `cdk deploy`, in the absence of this parameter, all stacks are
1157
- considered.
1158
-
1159
- If, instead of letting the CLI decide which resources to move, you want to
1160
- provide your own mapping of old to new locations, you can do so by passing a
1161
- mapping file to the CLI via the `--mapping-file` flag. This file should
1162
- contain a JSON object with the following format:
1169
+ You can resolve this ambiguity manually, by passing an override file via the
1170
+ `--override-file=<path>` CLI option. This file should contain a JSON object
1171
+ with the following structure:
1163
1172
 
1164
1173
  ```json
1165
1174
  {
@@ -1168,22 +1177,19 @@ contain a JSON object with the following format:
1168
1177
  "account": "123456789012",
1169
1178
  "region": "us-east-1",
1170
1179
  "resources": {
1171
- "Foo.OldName": "Bar.NewName"
1180
+ "Stack2.OldName": "Stack2.NewName"
1172
1181
  }
1173
1182
  }
1174
1183
  ]
1175
1184
  }
1176
1185
  ```
1177
1186
 
1178
- where `resources` is a mapping of resources from source to destination
1179
- locations for a given environment. Resource locations are in the format
1180
- `StackName.LogicalId`.The source must refer to a location where there is a
1181
- resource currently deployed, while the destination must refer to a location
1187
+ where `resources` is a mapping of resources from source to destination
1188
+ locations for a given environment. Resource locations are in the format
1189
+ `StackName.LogicalId`.The source must refer to a location where there is a
1190
+ resource currently deployed, while the destination must refer to a location
1182
1191
  that is not already occupied by any resource.
1183
1192
 
1184
- If you want to undo a refactor, you can use the `--revert` option in
1185
- conjunction with the `--mapping-file` option. It will apply the mapping in
1186
- reverse order (source becomes destination and vice versa).
1187
1193
 
1188
1194
  ### `cdk drift`
1189
1195
 
@@ -1208,6 +1214,31 @@ $ # Detect drift against the currently-deployed stack with the verbose flag enab
1208
1214
  $ cdk drift --verbose
1209
1215
  ```
1210
1216
 
1217
+ ### `cdk cli-telemetry`
1218
+
1219
+ Enables or disables cli telemetry collection for your local CDK App. Records your
1220
+ choice in `cdk.context.json`. You can also set your preference manually under the `context` key in your
1221
+ `~/.cdk.json` file or `<app-root>/cdk.json` file.
1222
+
1223
+ ```bash
1224
+ $ # Disable telemetry
1225
+ $ cdk cli-telemetry --disable
1226
+
1227
+ $ # Enable telemetry
1228
+ $ cdk cli-telemetry --enable
1229
+ ```
1230
+
1231
+ You can also check the current status on whether your CDK App is opted in or out of
1232
+ cli telemetry collection. Note that this takes into account all methods of disabling
1233
+ cli telemetry, including environment variables and
1234
+ [context values](https://docs.aws.amazon.com/cdk/v2/guide/context.html)
1235
+ that can be set in many different ways (such as `~/.cdk.json`).
1236
+
1237
+ ```bash
1238
+ $ # Check the current status of telemetry
1239
+ $ cdk cli-telemetry --status
1240
+ ```
1241
+
1211
1242
  ## Global Options
1212
1243
 
1213
1244
  ### `unstable`
@@ -1223,6 +1254,20 @@ cdk gc --unstable=gc
1223
1254
  The command will fail if `--unstable=gc` is not passed in, which acknowledges that the user
1224
1255
  is aware of the caveats in place for the feature.
1225
1256
 
1257
+ ### `telemetry-file`
1258
+
1259
+ Send your telemetry data to a local file (note that `--telemetry-file` is unstable, and must
1260
+ be passed in conjunction with `--unstable=telemetry`).
1261
+
1262
+ ```bash
1263
+ cdk list --telemetry-file=my/file/path --unstable=telemetry
1264
+ ```
1265
+
1266
+ The supplied path must be a non existing file. If the file exists, it will fail to log telemetry
1267
+ data but the command itself will continue uninterrupted.
1268
+
1269
+ > Note: The file will be written to regardless of your opt-out status.
1270
+
1226
1271
  ## Notices
1227
1272
 
1228
1273
  CDK Notices are important messages regarding security vulnerabilities, regressions, and usage of unsupported