Skip to content

(aws-cdk): cdk bootstrap prints YAML template even when using --json option #21456

@rantoniuk

Description

@rantoniuk

Describe the bug

OK, I'm either stupid and I'm missing something obvious or the command --show-template doesn't behave like it should.
The below commands are always printing the same template for me:

$ cdk bootstrap --show-template > x
$ cdk bootstrap --show-template --bootstrap-kms-key-id=AWS_KEY_MANAGED > x2
$ cdk bootstrap --show-template --bootstrap-customer-key > x3
$ cdk bootstrap --show-template --bootstrap-customer-key asd > x4
$ cdk bootstrap --show-template --json > x5

$ diff x* 
$
(no output, same files)

Why? There is no --dry-run- option, so I expect to be able to see the template modified with the CLI options to validate before actual deployment. Instead, even -j does not have any effect whatsoever for me. Am I missing something?

Also, in the template I see that it's possible to use AWS_MANAGED_KEY for FileAssetsBucketKmsKeyId.
Shouldn't this be possible to enable this via CLI (and be documented in cdk bootstrap -h) ?

I even tried to do the following:

  1. cdk bootstrap --show-template > template
  2. (edited the template file and set FileAssetsBucketKmsKeyId to AWS_MANAGED_KEY
  3. cdk bootstrap --cloudformation-execution-policies arn:aws:iam::aws:policy/AdministratorAccess aws://XXX/eu-west-1 --template template --no-execute

Result:

  • CDKToolkit: creating CloudFormation changeset... Environment bootstrapped (no changes).
  • CloudFormation shows an empty and FAILED changeset.

CDK CLI Version

2.35.0 (build 5c23578)

Framework Version

No response

Node.js Version

v14.19.3

OS

MacOS

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.effort/smallSmall work item – less than a day of effortgood first issueRelated to contributions. See CONTRIBUTING.mdp2package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions