mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-09 23:54:17 -06:00
93f31fce17
This commit adds a new "attachment" style resource for setting the policy of an AWS S3 bucket. This is desirable such that the ARN of the bucket can be referenced in an IAM Policy Document. In addition, we now suppress diffs on the (now-computed) policy in the S3 bucket for structurally equivalent policies, which prevents flapping because of whitespace and map ordering changes made by the S3 endpoint.
16 lines
322 B
Go
16 lines
322 B
Go
package aws
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/helper/schema"
|
|
"github.com/jen20/awspolicyequivalence"
|
|
)
|
|
|
|
func suppressEquivalentAwsPolicyDiffs(k, old, new string, d *schema.ResourceData) bool {
|
|
equivalent, err := awspolicy.PoliciesAreEquivalent(old, new)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
|
|
return equivalent
|
|
}
|