aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.66k stars 3.92k forks source link

core: Typo and bad command guidance for rebootstrap #31963

Open perpil opened 5 days ago

perpil commented 5 days ago

Describe the bug

With CDK 3.364, there is a slight typo runing should be running and an incorrect bootstrap command suggested. Instead of a comma between the different account/region pairs in the bootstrap command, it should be a space. i.e. cdk bootstrap aws://<redactedAccount>/us-east-1,aws://<redactedAccount>/us-west-2 should be cdk bootstrap aws://<redactedAccount>/us-east-1 aws://<redactedAccount>/us-west-2

Regression Issue

Last Known Working CDK Version

No response

Expected Behavior

Correct spelling and suggested command to rebootstrap can be copy and pasted.

Current Behavior

31885   (cli): Bootstrap stack outdated

    Overview: The bootstrap stack in aws://<redactedAccount>/us-east-1,aws://<redactedAccount>/us-west-2 is outdated.
              We recommend at least version 21, distributed with CDK CLI
              2.149.0 or higher. Please rebootstrap your environment by
              runing 'cdk bootstrap aws://<redactedAccount>/us-east-1,aws://<redactedAccount>/us-west-2'

    Affected versions: bootstrap: <21

    More information at: https://github.com/aws/aws-cdk/issues/31885

Running this command results in:

❯ cdk bootstrap aws:///us-east-1,aws:///us-west-2 Expected environment name in format 'aws:///', got: aws:///us-east-1,aws:///us-west-2

Reproduction Steps

This is an error in the text. To repro, attempt to deploy a stack that was bootstrapped with a version prior to 2.149

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.164.1 (build bb9275c)

Framework Version

No response

Node.js Version

20.13.1

OS

MacOS Sonoma 14.6.1

Language

TypeScript

Language Version

No response

Other information

Related to the fix in: https://github.com/aws/aws-cdk/issues/31885

ashishdhingra commented 5 days ago

Although, I'm unable to make notice appear when after bootstrapping CDK environment for region with CDK CLI version 2.145.0 (this has /cdk-bootstrap/hnb659fds/version SSM parameter with value 20), I do see a typo in notices.json. The mentioned notice with typo (runing should be running) is defined as below:

    {
      "title": "(cli): Bootstrap stack outdated",
      "issueNumber": 31885,
      "overview": "The bootstrap stack in {resolve:ENVIRONMENTS} is outdated. We recommend at least version 21, distributed with CDK CLI 2.149.0 or higher. Please rebootstrap your environment by runing 'cdk bootstrap {resolve:ENVIRONMENTS}'",
      "components": [
        {
          "name": "bootstrap",
          "version": "<21"
        }
      ],
      "schemaVersion": "1"
    }

Regarding, environments being displayed, the notice uses {resolve:ENVIRONMENTS}, which is a dynamic value resolved during CLI execution. {resolve:ENVIRONMENTS} would be resolved as comma separated list of values, e.g., aws://1234567890/us-east-1,aws://1234567890/us-east-2.

I'm able to confirm that running cdk bootstrap aws://<<ACCOUNT-ID>>/us-west-1,aws://<<ACCOUNT-ID>>/us-west-2 gives error Expected environment name in format 'aws://<account>/<region>', got: aws://<<ACCOUNT-ID>>/us-west-1,aws://<<ACCOUNT-ID>>/us-west-2. Using space character instead of comma, e.g. `cdk bootstrap aws://<<ACCOUNT-ID>>/us-west-1 aws://<<ACCOUNT-ID>>/us-west-2, works fine:

⏳  Bootstrapping environment aws://<<ACCOUNT-ID>>/us-west-1...
 ⏳  Bootstrapping environment aws://<<ACCOUNT-ID>>/us-west-2...
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.
CDKToolkit: creating CloudFormation changeset...
CDKToolkit: creating CloudFormation changeset...
CDKToolkit | 0/10 | 3:29:09 PM | UPDATE_IN_PROGRESS   | AWS::CloudFormation::Stack | CDKToolkit User Initiated
CDKToolkit | 0/10 | 3:29:11 PM | UPDATE_IN_PROGRESS   | AWS::SSM::Parameter     | CdkBootstrapVersion
CDKToolkit | 0/10 | 3:29:11 PM | UPDATE_IN_PROGRESS   | AWS::IAM::Role          | FilePublishingRole
CDKToolkit | 0/10 | 3:29:12 PM | UPDATE_IN_PROGRESS   | AWS::IAM::Role          | LookupRole
CDKToolkit | 0/10 | 3:29:12 PM | UPDATE_IN_PROGRESS   | AWS::IAM::Role          | ImagePublishingRole
...