1Password / shell-plugins

Seamless authentication for every tool in your terminal.
https://developer.1password.com/docs/cli/shell-plugins/
MIT License
506 stars 163 forks source link

cdk.go: support --profile flag by adding missing provisioner #463

Closed waiteb3 closed 1 month ago

waiteb3 commented 2 months ago

Overview

Fixes the cdk plugin not handling the --profile flag correctly when a profile is using role assumption. Now it matches the expected behavior of the aws plugin's --profile flag and the AWS_PROFILE environment variable.

Type of change

How To Test

If you have an existing CDK stack, you can confirm that using a profile to assume a role used for deployments.

cd $YOUR_CDK_DIR
cdk diff --profile cdk-stack-admin

Example ~/.aws/config file. Swap out with names and numbers from your account

[default]

[profile cdk-stack-admin]
source_profile=default
role_arn=arn:aws:iam::<AWS_ACC_NUM>:role/<CDK_ADMIN_ROLE>
role_session_name=cdk-stack-admin

Without the patch, the cdk will encounter the error below and fail

Need to perform AWS calls for account <AWS_ACC_NUM>, but no credentials have been configured

Changelog

AWS CDK Plugin now supports AWS Profiles that assume a role, when specified by the --plugin flag.

AndyTitu commented 1 month ago

Looks good to me functionally!