aws-cdk 2.1014.0 → 2.1016.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 (103) hide show
  1. package/README.md +65 -4
  2. package/THIRD_PARTY_LICENSES +64 -64
  3. package/build-info.json +2 -2
  4. package/db.json.gz +0 -0
  5. package/lib/api/aws-auth.d.ts +1 -0
  6. package/lib/api/aws-auth.js +3 -1
  7. package/lib/api/bootstrap/bootstrap-template.yaml +12 -1
  8. package/lib/api/bootstrap.js +2 -1
  9. package/lib/api/cloud-assembly.js +2 -1
  10. package/lib/api/cloudformation.js +2 -1
  11. package/lib/api/context.js +2 -1
  12. package/lib/api/deployments.js +2 -1
  13. package/lib/api/hotswap.js +2 -1
  14. package/lib/api/index.d.ts +12 -6
  15. package/lib/api/index.js +18 -7
  16. package/lib/api/notices.js +2 -1
  17. package/lib/api/plugin.js +2 -1
  18. package/lib/api/settings.js +2 -1
  19. package/lib/api/tags.js +2 -1
  20. package/lib/api-private.d.ts +3 -1
  21. package/lib/api-private.js +5 -2
  22. package/lib/cli/cdk-toolkit.d.ts +40 -2
  23. package/lib/cli/cdk-toolkit.js +70 -48
  24. package/lib/cli/cli-config.js +38 -3
  25. package/lib/cli/cli.js +17 -17
  26. package/lib/cli/convert-to-user-input.js +19 -1
  27. package/lib/cli/io-host/cli-io-host.d.ts +3 -3
  28. package/lib/cli/io-host/cli-io-host.js +10 -11
  29. package/lib/cli/messages.d.ts +1 -1
  30. package/lib/cli/messages.js +1 -1
  31. package/lib/cli/parse-command-line-arguments.js +47 -1
  32. package/lib/cli/root-dir.js +2 -2
  33. package/lib/cli/singleton-plugin-host.d.ts +1 -1
  34. package/lib/cli/singleton-plugin-host.js +3 -3
  35. package/lib/cli/user-configuration.js +5 -4
  36. package/lib/cli/user-input.d.ts +54 -0
  37. package/lib/cli/user-input.js +1 -1
  38. package/lib/cli/util/npm.js +2 -2
  39. package/lib/cli/version.js +2 -2
  40. package/lib/commands/context.js +2 -2
  41. package/lib/commands/init/init-hooks.js +2 -2
  42. package/lib/commands/init/init.js +2 -2
  43. package/lib/commands/init/os.js +2 -2
  44. package/lib/commands/list-stacks.d.ts +1 -1
  45. package/lib/commands/list-stacks.js +1 -1
  46. package/lib/commands/migrate.js +5 -4
  47. package/lib/context-providers.d.ts +1 -0
  48. package/lib/{api/logs-monitor.js → context-providers.js} +3 -2
  49. package/lib/cxapp/cloud-assembly.js +2 -2
  50. package/lib/cxapp/cloud-executable.d.ts +2 -2
  51. package/lib/cxapp/cloud-executable.js +6 -7
  52. package/lib/cxapp/environments.js +2 -2
  53. package/lib/cxapp/exec.d.ts +1 -1
  54. package/lib/cxapp/exec.js +6 -6
  55. package/lib/index.js +16078 -15003
  56. package/lib/init-templates/.init-version.json +1 -1
  57. package/lib/init-templates/.recommended-feature-flags.json +2 -1
  58. package/lib/legacy-exports-source.d.ts +1 -1
  59. package/lib/legacy-exports-source.js +3 -3
  60. package/lib/logging.js +4 -4
  61. package/lib/util.js +2 -1
  62. package/package.json +14 -14
  63. package/lib/api/environment.d.ts +0 -1
  64. package/lib/api/environment.js +0 -18
  65. package/lib/api/garbage-collection.d.ts +0 -1
  66. package/lib/api/garbage-collection.js +0 -18
  67. package/lib/api/logs-monitor.d.ts +0 -1
  68. package/lib/api/resource-import.d.ts +0 -1
  69. package/lib/api/resource-import.js +0 -18
  70. package/lib/api/rwlock.d.ts +0 -1
  71. package/lib/api/rwlock.js +0 -18
  72. package/lib/api/stack-events.d.ts +0 -1
  73. package/lib/api/stack-events.js +0 -18
  74. package/lib/api/toolkit-info.d.ts +0 -1
  75. package/lib/api/toolkit-info.js +0 -18
  76. package/lib/api/tree.d.ts +0 -1
  77. package/lib/api/tree.js +0 -18
  78. package/lib/api/work-graph.d.ts +0 -1
  79. package/lib/api/work-graph.js +0 -18
  80. package/lib/commands/diff.d.ts +0 -1
  81. package/lib/commands/diff.js +0 -7
  82. package/lib/context-providers/ami.d.ts +0 -1
  83. package/lib/context-providers/ami.js +0 -18
  84. package/lib/context-providers/availability-zones.d.ts +0 -1
  85. package/lib/context-providers/availability-zones.js +0 -18
  86. package/lib/context-providers/cc-api-provider.d.ts +0 -1
  87. package/lib/context-providers/cc-api-provider.js +0 -18
  88. package/lib/context-providers/endpoint-service-availability-zones.d.ts +0 -1
  89. package/lib/context-providers/endpoint-service-availability-zones.js +0 -18
  90. package/lib/context-providers/hosted-zones.d.ts +0 -1
  91. package/lib/context-providers/hosted-zones.js +0 -18
  92. package/lib/context-providers/index.d.ts +0 -1
  93. package/lib/context-providers/index.js +0 -18
  94. package/lib/context-providers/keys.d.ts +0 -1
  95. package/lib/context-providers/keys.js +0 -18
  96. package/lib/context-providers/load-balancers.d.ts +0 -1
  97. package/lib/context-providers/load-balancers.js +0 -18
  98. package/lib/context-providers/security-groups.d.ts +0 -1
  99. package/lib/context-providers/security-groups.js +0 -18
  100. package/lib/context-providers/ssm-parameters.d.ts +0 -1
  101. package/lib/context-providers/ssm-parameters.js +0 -18
  102. package/lib/context-providers/vpcs.d.ts +0 -1
  103. package/lib/context-providers/vpcs.js +0 -18
package/README.md CHANGED
@@ -189,6 +189,23 @@ The `change-set` flag will make `diff` create a change set and extract resource
189
189
  The `--no-change-set` mode will consider any change to a property that requires replacement to be a resource replacement,
190
190
  even if the change is purely cosmetic (like replacing a resource reference with a hardcoded arn).
191
191
 
192
+ The `--import-existing-resources` option will make `diff` create a change set and compare it using
193
+ the CloudFormation resource import mechanism. This allows CDK to detect changes and show report of resources that
194
+ will be imported rather added. Use this flag when preparing to import existing resources into a CDK stack to
195
+ ensure and validate the changes are correctly reflected by showing 'import'.
196
+
197
+ ```console
198
+ $ cdk diff
199
+ [+] AWS::DynamoDB::GlobalTable MyGlobalTable MyGlobalTable5DC12DB4
200
+
201
+ $ cdk diff --import-existing-resources
202
+ [←] AWS::DynamoDB::GlobalTable MyGlobalTable MyGlobalTable5DC12DB4 import
203
+ ```
204
+
205
+ In the output above:
206
+ [+] indicates a new resource that would be created.
207
+ [←] indicates a resource that would be imported into the stack instead.
208
+
192
209
  ### `cdk deploy`
193
210
 
194
211
  Deploys a stack of your CDK app to its environment. During the deployment, the toolkit will output progress
@@ -505,19 +522,34 @@ Hotswapping is currently supported for the following changes
505
522
  - VTL mapping template changes for AppSync Resolvers and Functions.
506
523
  - Schema changes for AppSync GraphQL Apis.
507
524
 
508
- You can optionally configure the behavior of your hotswap deployments in `cdk.json`. Currently you can only configure ECS hotswap behavior:
525
+ You can optionally configure the behavior of your hotswap deployments. Currently you can only configure ECS hotswap behavior:
526
+
527
+ | Property | Description | Default |
528
+ |--------------------------------|--------------------------------------|-------------|
529
+ | minimumHealthyPercent | Lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount | **REPLICA:** 100, **DAEMON:** 0 |
530
+ | maximumHealthyPercent | Upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount | **REPLICA:** 200, **DAEMON:**: N/A |
531
+ | stabilizationTimeoutSeconds | Number of seconds to wait for a single service to reach stable state, where the desiredCount is equal to the runningCount | 600 |
532
+
533
+ ##### cdk.json
509
534
 
510
535
  ```json
511
536
  {
512
537
  "hotswap": {
513
538
  "ecs": {
514
539
  "minimumHealthyPercent": 100,
515
- "maximumHealthyPercent": 250
540
+ "maximumHealthyPercent": 250,
541
+ "stabilizationTimeoutSeconds": 300,
516
542
  }
517
543
  }
518
544
  }
519
545
  ```
520
546
 
547
+ ##### cli arguments
548
+
549
+ ```console
550
+ cdk deploy --hotswap --hotswap-ecs-minimum-healthy-percent 100 --hotswap-ecs-maximum-healthy-percent 250 --hotswap-ecs-stabilization-timeout-seconds 300
551
+ ```
552
+
521
553
  **⚠ Note #1**: This command deliberately introduces drift in CloudFormation stacks in order to speed up deployments.
522
554
  For this reason, only use it for development purposes.
523
555
  **Never use this flag for your production deployments**!
@@ -1104,12 +1136,12 @@ exclude file, containing a list of destination locations to exclude. A
1104
1136
  location can be either the stack name + logical ID, or the construct path. For
1105
1137
  example, if you don't want to include the bucket and the distribution from
1106
1138
  the table above in the refactor, you can create a file called
1107
- `exclude.txt`with the following content:
1139
+ `exclude.txt` with the following content (destination locations separated by
1140
+ newlines):
1108
1141
 
1109
1142
  ```
1110
1143
  Web/Website/Origin/Resource
1111
1144
  Web/Website/Distribution/Resource
1112
- ]
1113
1145
  ```
1114
1146
 
1115
1147
  and pass it to the CLI via the `--exclude-file` flag:
@@ -1130,6 +1162,35 @@ The pattern language is the same as the one used in the `cdk deploy` command.
1130
1162
  However, unlike `cdk deploy`, in the absence of this parameter, all stacks are
1131
1163
  considered.
1132
1164
 
1165
+ If, instead of letting the CLI decide which resources to move, you want to
1166
+ provide your own mapping of old to new locations, you can do so by passing a
1167
+ mapping file to the CLI via the `--mapping-file` flag. This file should
1168
+ contain a JSON object with the following format:
1169
+
1170
+ ```json
1171
+ {
1172
+ "mappings": [
1173
+ {
1174
+ "account": "123456789012",
1175
+ "region": "us-east-1",
1176
+ "resources": {
1177
+ "Foo.OldName": "Bar.NewName"
1178
+ }
1179
+ }
1180
+ ]
1181
+ }
1182
+ ```
1183
+
1184
+ where `resources` is a mapping of resources from source to destination
1185
+ locations for a given environment. Resource locations are in the format
1186
+ `StackName.LogicalId`.The source must refer to a location where there is a
1187
+ resource currently deployed, while the destination must refer to a location
1188
+ that is not already occupied by any resource.
1189
+
1190
+ If you want to undo a refactor, you can use the `--revert` option in
1191
+ conjunction with the `--mapping-file` option. It will apply the mapping in
1192
+ reverse order (source becomes destination and vice versa).
1193
+
1133
1194
  ## Notices
1134
1195
 
1135
1196
  CDK Notices are important messages regarding security vulnerabilities, regressions, and usage of unsupported