Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation uses deprecated SecretStringValueBeta1 #20122

Closed
kbakk opened this issue Apr 28, 2022 · 6 comments · Fixed by #20672
Closed

Documentation uses deprecated SecretStringValueBeta1 #20122

kbakk opened this issue Apr 28, 2022 · 6 comments · Fixed by #20672
Labels
@aws-cdk/aws-secretsmanager Related to AWS Secrets Manager bug This issue is a bug. documentation This is a problem with documentation. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@kbakk
Copy link

kbakk commented Apr 28, 2022

Describe the issue

Example shown in https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.AccessKey.html:

// Creates a new IAM user, access and secret keys, and stores the secret access key in a Secret.
const user = new iam.User(this, 'User');
const accessKey = new iam.AccessKey(this, 'AccessKey', { user });
const secretValue = secretsmanager.SecretStringValueBeta1.fromToken(accessKey.secretAccessKey.toString());
new secretsmanager.Secret(this, 'Secret', {
   secretStringBeta1: secretValue,
});

This will raise a deprecation warning, as #19543 deprecated the SecretStringValueBeta1 method.

(Side-note: I'm curious on how to solve this properly using cdk.SecretValue.)

Links

@kbakk kbakk added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Apr 28, 2022
@github-actions github-actions bot added the @aws-cdk/aws-secretsmanager Related to AWS Secrets Manager label Apr 28, 2022
@kbakk kbakk changed the title (short issue description) Documentation uses deprecated SecretStringValueBeta1 Apr 28, 2022
@laurelmay
Copy link
Contributor

laurelmay commented Apr 29, 2022

Some sample code on using this with the new API would be:

    const user = new iam.User(this, "User");
    const accessKey = new iam.AccessKey(this, "AccessKey", { user });
    const secret = new secrets.Secret(this, "Secret", {
      secretStringValue: accessKey.secretAccessKey,
    });

Not sure exactly how the "Example" gets generated (that code snippet seems to come from the aws-secretsmanager package, not aws-iam), otherwise I'd open a PR to fix.

There isn't a need to construct a cdk.SecretValue yourself in this case as secretAccessKey is already a SecretValue.

@kbakk
Copy link
Author

kbakk commented Apr 29, 2022

Thanks!

There isn't a need to construct a cdk.SecretValue yourself in this case as secretAccessKey is already a SecretValue.

This gotcha was what I struggled with. 🙂

@skinny85
Copy link
Contributor

skinny85 commented May 3, 2022

Thanks for opening the issue @kbakk. I guess we need to fix the example code here:

* const secretValue = secretsmanager.SecretStringValueBeta1.fromToken(accessKey.secretAccessKey.toString());

@skinny85 skinny85 added bug This issue is a bug. good first issue Related to contributions. See CONTRIBUTING.md p1 effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. p1 labels May 3, 2022
@skinny85 skinny85 removed their assignment May 3, 2022
@triqp
Copy link

triqp commented May 20, 2022

Looking at making my first contribution. Is @kylelaker recommended code change appropriate?

@skinny85
Copy link
Contributor

@triqp yes, it is 🙂.

Check out the "Contributing" guide: https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md.

@mergify mergify bot closed this as completed in #20672 Jun 13, 2022
mergify bot pushed a commit that referenced this issue Jun 13, 2022
Fixes #20122 
Implements proposed example code mentioned in the issue.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️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.

daschaa added a commit to daschaa/aws-cdk that referenced this issue Jul 9, 2022
Fixes aws#20122 
Implements proposed example code mentioned in the issue.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-secretsmanager Related to AWS Secrets Manager bug This issue is a bug. documentation This is a problem with documentation. effort/small Small work item – less than a day of effort good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants