hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.64k stars 9.02k forks source link

[Bug]: `aws_cloudtrail` always shows changes due to switching `insight_type` values #37525

Closed snarky closed 1 week ago

snarky commented 2 months ago

Terraform Core Version

1.8.3

AWS Provider Version

5.49.0

Affected Resource(s)

Expected Behavior

Terraform should recognize that there are no actual changes in the insight_selector blocks and should not show any updates in the execution plan.

Actual Behavior

Terraform shows an in-place update with the insight_type values switching:

Relevant Error/Panic Output Snippet

~ insight_selector {
    ~ insight_type = "ApiErrorRateInsight" -> "ApiCallRateInsight"
}
~ insight_selector {
    ~ insight_type = "ApiCallRateInsight" -> "ApiErrorRateInsight"
}

Terraform Configuration Files

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudtrail

Steps to Reproduce

Define an aws_cloudtrail resource with insight_selector blocks:

resource "aws_cloudtrail" "cloudtrail" {
  name = "XXX"

  insight_selector {
    insight_type = "ApiErrorRateInsight"
  }

  insight_selector {
    insight_type = "ApiCallRateInsight"
  }
}

Run terraform apply twice.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 2 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

acwwat commented 2 months ago

Looks like the order in the AWS API response is not deterministic - sometimes the order is OK, sometimes it's not. In any case, it makes sense to make the argument unordered using a Set as a catch-all.

github-actions[bot] commented 1 week ago

[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

github-actions[bot] commented 1 week ago

This functionality has been released in v5.59.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!