Skip to content

Commit

Permalink
Fix: Ensure that SqsManagedSseEnabled (sqs_managed_sse_enabled) is al…
Browse files Browse the repository at this point in the history
…ways passed to CreateQueue SQS API

# Community Note

Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes: #22197

## Summary

Affected resource: `aws_sqs_queue`

Seems that since 01 of September 2022 [CreateQueue SQS API](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html) changed and if **SqsManagedSseEnabled** parameter is not passed, SQS created as encrypted by default with `aws_sqs_queue` resource.

Current logic in provider (internal/attrmap/attrmap.go, ResourceDataToAPIAttributesCreate) omit SqsManagedSseEnabled (sqs_managed_sse_enabled) if it's equal false. Which causes SQS to be created as encrypted and then it's changed to unencrypted on next apply.

This change fixes it, but probably not in a best way.
  • Loading branch information
nantiferov committed Sep 16, 2022
1 parent da38070 commit 607dcca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/attrmap/attrmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ func (m AttributeMap) ResourceDataToAPIAttributesCreate(d *schema.ResourceData)

switch v, t := d.Get(tfAttributeName), attributeInfo.tfType; t {
case schema.TypeBool:
if v := v.(bool); v {
v := v.(bool)
if tfAttributeName == "sqs_managed_sse_enabled" {
apiAttributeValue = strconv.FormatBool(v)
} else if v {
apiAttributeValue = strconv.FormatBool(v)
}
case schema.TypeInt:
Expand Down

0 comments on commit 607dcca

Please sign in to comment.