-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
bugfix - #4789 AWS Secrets Manager - retrieve json secret as a map #5087
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ozbillwang 👋 Thanks for submitting this. In addition to the below items, which might would prevent us from accepting this pull request, we may opt to not create a second attribute at all.
The next major version of Terraform should support jsondecode()
as a built-in function, removing the necessity of needing a separate attribute to break apart the JSON (when it is JSON).
@@ -20,7 +21,7 @@ func dataSourceAwsSecretsManagerSecretVersion() *schema.Resource { | |||
ForceNew: true, | |||
}, | |||
"secret_string": { | |||
Type: schema.TypeString, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing an attribute type is a breaking change for existing Terraform configurations. This new behavior should be handled by creating a new attribute and a new acceptance test added to cover if and when this new attribute is available.
There are also other potential issues with introducing this second attribute as briefly outlined in: #4613 (comment)
d.Set("secret_string", output.SecretString) | ||
var sec map[string]interface{} | ||
if err = json.Unmarshal([]byte(*output.SecretString), &sec); err != nil { | ||
return fmt.Errorf("Error getting secret string: %s", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is valid to create a Secrets Manager secret that is a single string value (not JSON). This error should only be logged to not break handling with those types of secrets.
I provided additional information about this handling in #4789 (comment) |
Thanks for reviewing, this PR is not suitable, I will close it and wait for new v0.12 release. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Fixes #4789
Changes proposed in this pull request:
Tasks:
Output from acceptance testing:
Here is my test code
Result: