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

aws-rds: generate password/secret with SnapshotCredentials #20432

Closed
mostafafarzaneh opened this issue May 20, 2022 · 4 comments · Fixed by #20448
Closed

aws-rds: generate password/secret with SnapshotCredentials #20432

mostafafarzaneh opened this issue May 20, 2022 · 4 comments · Fixed by #20448
Assignees
Labels
@aws-cdk/aws-rds Related to Amazon Relational Database 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

@mostafafarzaneh
Copy link

Describe the issue

There are two methods in the aws-rds.SnapshotCredentials for generating password/secret for the snapshot:
1- fromGeneratedPassword 2- fromGeneratedSecret
What is the difference between these two methods? The documentation says the same thing about them.

Links

SnapshotCredentials.

@mostafafarzaneh mostafafarzaneh added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels May 20, 2022
@github-actions github-actions bot added the @aws-cdk/aws-rds Related to Amazon Relational Database label May 20, 2022
@peterwoodworth
Copy link
Contributor

Looks to me that the only difference is that fromGeneratedSecret() will set the replacePasswordOnCriteriaChange prop to true when DatabaseInstanceFromSnapshot and ServerlessClusterFromSnapshot create the DatabaseSecret. fromGeneratedPassword() will not set this prop at all, making it end up defaulting to false.

public static fromGeneratedSecret(username: string, options: SnapshotCredentialsFromGeneratedPasswordOptions = {}): SnapshotCredentials {
return {
...options,
generatePassword: true,
replaceOnPasswordCriteriaChanges: true,
username,
};
}

public static fromGeneratedPassword(username: string, options: SnapshotCredentialsFromGeneratedPasswordOptions = {}): SnapshotCredentials {
return {
...options,
generatePassword: true,
username,
};
}

Would you be willing to help us clarify this in the documentation? Check out Contributing.md to get started. Let me know if you have any questions 🙂

@peterwoodworth peterwoodworth added good first issue Related to contributions. See CONTRIBUTING.md p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels May 21, 2022
@mostafafarzaneh
Copy link
Author

Thanks for the clarification.
So, what is the point of using fromGeneratedPassword? What is the scenario someone may want to use it in?

It is worth mentioning, as I pointed out in #20434, the fromGeneratedSecret does not work.

Would you be willing to help us clarify this in the documentation?

I would love to contribute. I will reach out to you if need help

@jogold
Copy link
Contributor

jogold commented May 21, 2022

See the PR description here #11237 for a detailed explanation.

Switching from fromGeneratedPassword() to fromGeneratedSecret() for existing clusters/instances replaces the password (breaking). fromGeneratedPassword() was initially deprecated but then undeprecated in 797edbd (#17683).

@mergify mergify bot closed this as completed in #20448 May 21, 2022
mergify bot pushed a commit that referenced this issue May 21, 2022
Closes #20432

----

### All Submissions:

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

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/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/master/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.

wphilipw pushed a commit to wphilipw/aws-cdk that referenced this issue May 23, 2022
Closes aws#20432

----

### All Submissions:

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

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/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/master/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-rds Related to Amazon Relational Database 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