Created
February 13, 2025 19:28
-
-
Save lovemycodesnippets/bf0ae29d2618b5bbd8169f6dd56307bb to your computer and use it in GitHub Desktop.
From the article "Can AI Generate Functional Terraform?"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "aws_iam_policy" "lambda_s3" { | |
name = "lambda_s3_policy" | |
policy = jsonencode({ | |
Version = "2012-10-17", | |
Statement = [{ | |
Effect = "Allow", | |
Action = ["s3:GetObject", "s3:PutObject"], | |
Resource = "${aws_s3_bucket.example.arn}/*" | |
}] | |
}) | |
} | |
resource "aws_iam_role_policy_attachment" "lambda_attach" { | |
role = aws_iam_role.lambda_exec.name | |
policy_arn = aws_iam_policy.lambda_s3.arn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment