terraform-to-secrets: Handle case where tags are None #11
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 adds a check in
terraform-to-secrets
to verify that a resource's tags are not equal toNone
. If the tags areNone
, it's value is changed to an empty dictionary so that the rest of the script runs correctly..💭 Motivation and Context
I encountered a situation recently where
terraform-to-secrets
was failing:The output above shows the two additional lines of debug output that I added to illustrate the problem:
Note that the
aws_iam_role.s3_read
resource had atags
element, but its value was set toNone
, which caused theAttributeError
seen above.I am not sure if something in AWS or Terraform changed recently to cause this behavior or if we have just never created a role without any tags before.
The code in this PR simply does a check for this situation and if it occurs, it replaces
None
with an empty dictionary so that processing can continue.🧪 Testing
I tested the fix locally and verified that the script ran successfully.
📷 Screenshots (if appropriate)
🚥 Types of Changes
✅ Checklist