gpt4 book ai didi

amazon-s3 - Terraform aws_iam_policy_document 条件正确的语法

转载 作者:行者123 更新时间:2023-12-04 00:17:32 25 4
gpt4 key购买 nike

这部分存储桶策略如何写成 aws_iam_policy_document?

    "Condition": {
"StringEquals": {
"s3:x-amz-acl": "bucket-owner-full-control",
"aws:SourceAccount": "xxxxxxxxxxxx"
},
"ArnLike": {
"aws:SourceArn": "arn:aws:s3:::my-tf-test-bucket"
}
condition {
test = "StringEquals"
values = []
variable = ""
}
帮助 :)。

最佳答案

aws_iam_policy_document 支持嵌套的 condition 指令。以下 Terraform 配置应该会有所帮助:

data "aws_iam_policy_document" "iam_policy_document" {
condition {
test = "StringEquals"

values = [
"bucket-owner-full-control"
]

variable = "s3:x-amz-acl"
}

condition {
test = "StringEquals"

values = [
"xxxxxxxxxxxx"
]

variable = "aws:SourceAccount"
}

condition {
test = "ArnLike"

values = [
"arn:aws:s3:::my-tf-test-bucket"
]

variable = "aws:SourceArn"
}
}

关于amazon-s3 - Terraform aws_iam_policy_document 条件正确的语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62831874/

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