gpt4 book ai didi

amazon-s3 - 如何给目标bucket日志传送组WRITE和READ_ACP权限?

转载 作者:行者123 更新时间:2023-12-03 09:58:32 24 4
gpt4 key购买 nike

我正在尝试使用 terraform 设置 cloudfront dist 和 s3 存储桶。当我运行 terraform apply 时,它​​返回以下错误:

  • aws_s3_bucket.app: Error putting S3 logging: InvalidTargetBucketForLogging: You must give the log-delivery group WRITE and READ_ACP permissions to the target bucket


我的 S3.tf 文件:
data "aws_iam_policy_document" "s3_policy" {
policy_id = "PolicyForCloudFrontPrivateContent"

statement {
sid = "1"
actions = ["s3:GetObject"]
resources = ["arn:aws:s3:::${local.name_env}/*"]

principals {
type = "AWS"
identifiers = ["${aws_cloudfront_origin_access_identity.origin_access_identity.iam_arn}"]
}
}
}

resource "aws_s3_bucket" "app" {
bucket = "${local.name_env}"
policy = "${data.aws_iam_policy_document.s3_policy.json}"

logging {
target_bucket = "${local.logs_bucket}"
target_prefix = "app-${var.environment}"
}

versioning {
enabled = true
}

tags = "${local.tags}"
}

最佳答案

您需要将 acl 属性添加到您的 aws_s3_bucket,其值为“log-delivery-write”。

resource "aws_s3_bucket" "app" {
bucket = "${local.name_env}"
acl = "log-delivery-write"
...
}

关于amazon-s3 - 如何给目标bucket日志传送组WRITE和READ_ACP权限?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55585003/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com