aws_iam_policy_document
ポリシードキュメントを生成できるdata
policy="${aws_iam_policy_document.my_document.json}とかでjsonのポリシードキュメントを生成できる
↓生jsonを書く、これはやりたくない
code:tf
resource "aws_s3_bucket_policy" "my-bucket-policy" {
bucket = "${aws_s3_bucket.my-bucket.id}"
policy = <<POLICY
{
"Version":"2012-10-17",
"Statement": [
{
"Effect":"Deny",
"Principal":"*",
"Action":"s3:*",
"Resource": [
"arn:aws:s3:::${aws_s3_bucket.my-bucket.id}",
"arn:aws:s3:::${aws_s3_bucket.my-bucket.id}/*"
],
"Condition": {
"StringNotEquals": {
"aws:username": [
"my-bucket-user"
]
}
}
}
]
}
POLICY
}
これは良い
data "aws_iam_policy_document"からjsonポリシーを生成するパターン/icons/good.icon