Support GitHub environment secrets in terraform-to-secrets
#111
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🗣 Description
This PR updates the
terraform-to-secrets
script to include a new option for specifying the GitHub environment to store the secret(s) in. Previously, this script only was able to upload repository secrets.💭 Motivation and context
As part of our work to properly segment COOL IAM user accounts into their own environments (e.g. Production, Staging, etc.) we plan to take advantage of GitHub Environments to store environment-specific details such as build user roles and third-party bucket names. In order to do this, it will be extremely useful for
terraform-to-secrets
to be able to store GitHub environment secrets.🧪 Testing
I tested this by running the modified version of the script in a repo where I created a
staging-a
environment (see here if you have access). The script was able to successfully store secrets in thatstaging-a
environment.For regression testing, I confirmed that running the updated script without providing a GitHub environment name worked the same way that it has worked in the past - repository secrets were created, not environment secrets.
I also tested to ensure that error handling works if a non-existent environment name is provided to the script:
✅ Pre-approval checklist