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

Fix: Ensure that SqsManagedSseEnabled (sqs_managed_sse_enabled) is always passed to CreateQueue SQS API #26843

Conversation

nantiferov
Copy link
Contributor

@nantiferov nantiferov commented Sep 16, 2022

Summary

Affected resource: aws_sqs_queue

Seems that since 01 of September 2022 CreateQueue SQS API 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.
Closes: #22197

Output from acceptance testing:

NOTE: attrmap package is used in couple of other services, but this change affects only SQS I believe.

$ make testacc PKG=sqs
...
PASS
ok   github.com/hashicorp/terraform-provider-aws/internal/service/sqs 2314.165s

…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.
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Please review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Sep 16, 2022
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @nantiferov 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@celik0311
Copy link

I am seeing this issue as well. When I set the resource variable to false I need to apply terraform 2x if the value defined is different than the default. As an example, In the case where sqs_managed_sse_enabled is set to false terraform needs to be applied 2x, since when its created it gets set to aws' default of true and then the 2nd apply to set it back to false.

@nantiferov nantiferov marked this pull request as ready for review October 2, 2022 20:32
@ewbankkit ewbankkit added service/sqs Issues and PRs that pertain to the sqs service. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 4, 2022
@ewbankkit ewbankkit added the upstream Addresses functionality related to the cloud provider. label Oct 18, 2022
@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Oct 18, 2022
@ewbankkit
Copy link
Contributor

@nantiferov Thanks for the contribution 🎉 👏.

It looks like Amazon announced this change a couple of weeks ago: https://aws.amazon.com/about-aws/whats-new/2022/10/amazon-sqs-announces-server-side-encryption-ssq-managed-sse-sqs-default/.

The best way to fix this is to mark the aws_sqs_queue sqs_managed_sse_enabled attribute as Computed. To ensure backwards compatibility this means that Terraform will only perform drift detection of the attribute's value when present in a configuration.

@ewbankkit ewbankkit merged commit 8442b5b into hashicorp:main Oct 18, 2022
@github-actions github-actions bot added this to the v4.36.0 milestone Oct 18, 2022
@BehbudSh
Copy link

Hi. I'm sorry but it's not fixed :/. It brakes our Pipeline consitency. It Deploys as a "True" with encryption enabled and tries to disable it when we are deploying again.

@nantiferov
Copy link
Contributor Author

nantiferov commented Oct 19, 2022

@ewbankkit thank you for review and merge, but as @BehbudSh mentioned, afaik this won't fix the issue as it's related tosqs_managed_sse_enabled is skipped during creation of SQS if it's false.

@ewbankkit
Copy link
Contributor

@nantiferov Thanks for chasing up on this. As usual, lack of a covering acceptance test case failed to uncover the real problem.
I have made the change to always send a configured sqs_managed_sse_enabled value of false when creating an SQS Queue in #27335.

@github-actions
Copy link

This functionality has been released in v4.36.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/sqs Issues and PRs that pertain to the sqs service. size/XS Managed by automation to categorize the size of a PR. upstream Addresses functionality related to the cloud provider.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqs_managed_sse_enabled used to default to false but now defaults to true
4 participants