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.5k stars 3.85k forks source link

core: cdk.json "qualifier" ignored #28249

Open thoward-godaddy opened 9 months ago

thoward-godaddy commented 9 months ago

Describe the bug

Setting qualifier attribute in cdk.json appears to not have any impact on running cdk bootstrap as it continues to use the default qualifier.

Expected Behavior

Setting the qualifier attribute in cdk.json should behave the same as running cdk bootstrap --qualifier <QUALIFIER_VALUE>.

Current Behavior

Running cdk bootstrap does not inherit the qualifier value stored in cdk.json

Reproduction Steps

Add a qualifier value to cdk.json:

{
  "app": "npx ts-node --prefer-ts-exts bin/app.ts",
  "versionReporting": false,
  "watch": {
    "include": [
      "**"
    ],
    "exclude": [
      "README.md",
      "cdk*.json",
      "**/*.d.ts",
      "**/*.js",
      "tsconfig.json",
      "package*.json",
      "yarn.lock",
      "node_modules",
      "test"
    ]
  },
  "context": {
    "@aws-cdk/core:bootstrapQualifier": "sample-app",
    "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
    "@aws-cdk/core:stackRelativeExports": true,
    "@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
    "@aws-cdk/aws-lambda:recognizeVersionProps": true,
    "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
    "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
    "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
    "@aws-cdk/aws-iam:minimizePolicies": true,
    "@aws-cdk/core:target-partitions": [
      "aws",
      "aws-cn"
    ],
    "@aws-cdk/core:newStyleStackSynthesis": true
  },
  "qualifier": "sample-app",
  "toolkitStackName": "sample-app-cdk-toolkit"
}

Run cdk bootstrap and observe resources being created using the default qualifier.

Possible Solution

Unkown, I'd assume the CLI should plug in the qualifier value from cdk.json if not explicitly provided as an option to the command.

Additional Information/Context

No response

CDK CLI Version

2.113.0 (build ccd534a)

Framework Version

No response

Node.js Version

v20.9.0

OS

OSX 13.6 (22G120)

Language

TypeScript

Language Version

No response

Other information

No response

github-actions[bot] commented 9 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

pahud commented 9 months ago

Did you mean cdk bootstrap --qualifier <QUALIFIER_VALUE> works but it just ignores the pre-defined value in cdk.json?

github-actions[bot] commented 9 months ago

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

thoward-godaddy commented 9 months ago

Did you mean cdk bootstrap --qualifier <QUALIFIER_VALUE> works but it just ignores the pre-defined value in cdk.json?

Yeah, I'd expect it to use the value in cdk.json if the --qualifier option is not provided to the command.

taabrcr commented 7 months ago

When doing a cdk synth or cdk deploy using the cdk version "2.123.0 (build a594112)", this is being ignored and breaks our deployments:

"context": { "@aws-cdk/core:bootstrapQualifier": "myqualifier", }

Please fix this problem.