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

Add helper functions for AWS Secrets Manager #578

Merged
merged 2 commits into from
Jul 30, 2020
Merged

Conversation

bwhaley
Copy link
Contributor

@bwhaley bwhaley commented Jul 28, 2020

This introduces three helper functions for AWS Secrets Manager:

  • CreateSecretStringWithDefaultKey() - Create a secret using the default KMS key
  • GetSecretValue() - Get a secret value by name or ARN
  • DeleteSecret() - Delete a secret, either immediately or after the default 30 day recovery window

When used with forceDelete=true to delete immediately, this should be a very low cost operation since secrets cost $0.40 per month and they are prorated based on the number of hours.

@bwhaley
Copy link
Contributor Author

bwhaley commented Jul 29, 2020

I've incorporated all the feedback. Upon further reflection, given the contribution guidelines, does this really pass the "complexity" test for what should be included in Terratest? As you can see from the functions, nothing here is very complex. Just more convenient. It's fine if you don't think this should be added in order to reduce sprawl... just let me know and I'll move this functionality over to the test I'm working on. Thanks!

Copy link
Member

@brikis98 brikis98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one doesn't do very well on the complexity test, but does do well on the popularity test. I've had to write nearly identical logic several times in our codebase already, and I suspect as we use AWS Secrets Manager more, it'll only show up more and more, so I think I'm OK with adding this.

@bwhaley
Copy link
Contributor Author

bwhaley commented Jul 30, 2020

Sounds good. Thanks for the review!

@bwhaley bwhaley merged commit bb69f3e into master Jul 30, 2020
@bwhaley bwhaley deleted the secretsmanager-helpers branch July 30, 2020 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants