Skip to content

cli-lib-alpha: bootstrap with bad argument name for trust and trustForLookup #30404

Closed
@juanenriqueescobar

Description

@juanenriqueescobar

Describe the bug

trust and trustForLookup options are overwriting qualifier, so it's impossible to bootstrap a new account.

https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cli-lib-alpha/lib/cli.ts#L187C1-L190

Expected Behavior

bootstrap a new account with custom options using cli-lib-alpha

Current Behavior

qualifier is defined as array and bootstrap fail with: failed bootstrapping: InvalidParameterType: Expected params.Parameters[6].ParameterValue to be a string

Reproduction Steps

 await cli.bootstrap({
    trust: '00000000000',
    trustForLookup: '11111111111111',
    qualifier: 'hnb659fds',
 })

trace show this:

"Parameters": [
        { "ParameterKey": "TrustedAccounts", "ParameterValue": "000000000," },
        { "ParameterKey": "TrustedAccountsForLookup", "ParameterValue": "" },
        {
            "ParameterKey": "CloudFormationExecutionPolicies",
            "ParameterValue": "arn:aws:iam::aws:policy/AdministratorAccess"
        },
        { "ParameterKey": "FileAssetsBucketName", "UsePreviousValue": true },
        { "ParameterKey": "FileAssetsBucketKmsKeyId", "UsePreviousValue": true },
        { "ParameterKey": "ContainerAssetsRepositoryName", "UsePreviousValue": true },
        { "ParameterKey": "Qualifier", "ParameterValue": ["hnb659fds", "0000000000000", "111111111111111"] },
        { "ParameterKey": "PublicAccessBlockConfiguration", "ParameterValue": "true" },
        { "ParameterKey": "InputPermissionsBoundary", "UsePreviousValue": true },
        { "ParameterKey": "UseExamplePermissionsBoundary", "UsePreviousValue": true },
        { "ParameterKey": "BootstrapVariant", "UsePreviousValue": true }
    ],

problem is in this line:

{ "ParameterKey": "Qualifier", "ParameterValue": ["hnb659fds", "0000000000000", "111111111111111"] },

Possible Solution

fix parameter names for

trust
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cli-lib-alpha/lib/cli.ts#L188

and trustForLookup
https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cli-lib-alpha/lib/cli.ts#L189

Additional Information/Context

No response

CDK CLI Version

2.143.0

Framework Version

No response

Node.js Version

any

OS

any

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.cliIssues related to the CDK CLIeffort/smallSmall work item – less than a day of effortp2package/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