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

[Bug]: sns/topic objects have changed outside of Terraform #28991

Open
YakDriver opened this issue Jan 19, 2023 · 4 comments
Open

[Bug]: sns/topic objects have changed outside of Terraform #28991

YakDriver opened this issue Jan 19, 2023 · 4 comments
Labels
service/sns Issues and PRs that pertain to the sns service.

Comments

@YakDriver
Copy link
Member

YakDriver commented Jan 19, 2023

Terraform 1.3.7
AWS provider 4.50.0.

It seems it's still randomly happens. Not every time and seems like amount of diff decreased.

As I remember, before it was happening almost in 100% of runs and for every sns resource. Now for couple of them or so. For SNS it shows as usual changed order in policy.

Examples:

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:

  # module.sns.aws_sns_topic.this["topic1"] has changed
  ~ resource "aws_sns_topic" "this" {
...
      ~ policy                                   = jsonencode(
          ~ {
              ~ Statement = [
                  ~ {
                      ~ Action    = [
                          - "SNS:GetTopicAttributes",
                          + "SNS:Subscribe",
                            "SNS:SetTopicAttributes",
                          - "SNS:AddPermission",
                            "SNS:RemovePermission",
                          - "SNS:DeleteTopic",
                          - "SNS:Subscribe",
                          - "SNS:ListSubscriptionsByTopic",
                          + "SNS:Receive",
                            "SNS:Publish",
                          + "SNS:ListSubscriptionsByTopic",
                          + "SNS:GetTopicAttributes",
                          + "SNS:DeleteTopic",
                          + "SNS:AddPermission",
                        ]
                        # (5 unchanged elements hidden)
                    },

References

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/sns Issues and PRs that pertain to the sns service. label Jan 19, 2023
@YakDriver YakDriver changed the title [bug] SNS Objects have changed outside of Terraform [Bug]: SNS Objects have changed outside of Terraform Jan 19, 2023
@YakDriver YakDriver changed the title [Bug]: SNS Objects have changed outside of Terraform [Bug]: sns/topic objects have changed outside of Terraform Jan 19, 2023
@nantiferov
Copy link
Contributor

nantiferov commented Jan 31, 2023

Hi @YakDriver

I managed to create test config which reproduces my issues. It's not ideal in terms of code quality, since it's based on some legacy code.

So the issue with drift reproduces in ~95% of cases and always related to previously changed state. I.e. if previous state change was to add SNS, in next plan we'll get for this SNS Objects have changed outside of Terraform related to policy. If SQS was changed, we get Objects have changed outside of Terraform for that SQS related to policy as well.

This is repository with test configuration https://github.com/nantiferov/test-sns-sqs
Its README.md describes how to reproduce issue in details.

Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jan 20, 2025
@nantiferov
Copy link
Contributor

Not stale

@github-actions github-actions bot removed the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/sns Issues and PRs that pertain to the sns service.
Projects
None yet
Development

No branches or pull requests

2 participants