S3 存储桶 ACL 的 MissingSecurityHeader 错误

jip*_*pot 8 amazon-s3 amazon-web-services terraform terraform-provider-aws

我定义了以下 s3 存储桶:

module "bucket" {
  source  = "terraform-aws-modules/s3-bucket/aws"
  version = "3.1.0"

  bucket = local.test-bucket-name
  acl    = null

  grant = [{
    type       = "CanonicalUser"
    permission = "FULL_CONTROL"
    id         =  data.aws_canonical_user_id.current.id
    }, {
    type       = "CanonicalUser"
    permission = "FULL_CONTROL"
    id         = data.aws_cloudfront_log_delivery_canonical_user_id.cloudfront.id
    }
  ]
  object_ownership = "BucketOwnerPreferred"
}
Run Code Online (Sandbox Code Playgroud)

但是当我尝试terraform apply这样做时,我收到错误:

错误:更新 S3 存储桶 ACL(日志、私有)时出错:MissingSecurityHeader:您的请求缺少必需的标头状态代码:400

该错误消息不是很具体。我是否缺少某种类型的标题?

小智 16

我在将 AWS 提供商从 4.x 更新到 5.3.0 时遇到了这个问题,其中一些存储桶以前的 ACL 为private,并且希望将它们设置为null,就像之前的答案一样。

然而,这个问题对我来说只是传递性的——terraform apply第二次运行又回来了No changes. Your infrastructure matches the configuration。我不需要手动修改任何 ACL。

已向 AWS 提供商提交错误报告,以避免terraform apply再次执行此操作。请参阅此处:https://github.com/hashicorp/terraform-provider-aws/issues/31633