Created
February 13, 2025 19:27
-
-
Save lovemycodesnippets/ac3776b9e2847cdd86288298087379f8 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_s3_bucket" "example" { | |
bucket = "example-bucket" | |
} | |
resource "aws_lambda_function" "example" { | |
function_name = "example_lambda" | |
s3_bucket = aws_s3_bucket.example.bucket | |
s3_key = "lambda_function.zip" | |
handler = "index.handler" | |
runtime = "python3.8" | |
role = aws_iam_role.lambda_exec.arn | |
} | |
resource "aws_iam_role" "lambda_exec" { | |
name = "lambda_exec_role" | |
assume_role_policy = jsonencode({ | |
Version = "2012-10-17", | |
Statement = [{ | |
Effect = "Allow", | |
Principal = { Service = "lambda.amazonaws.com" }, | |
Action = "sts:AssumeRole" | |
}] | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment