I have an existing lambda. The new terraform script is creating a lambda and adding S trigger.
Getting error “Can’t access attributes on a primitive-typed value (string)”
data “aws_s3_bucket” “selected” {
bucket = var.my_bucket_name
}
Adding S3 bucket as trigger
resource “aws_s3_bucket_notification” “aws-lambda-trigger” {
bucket = data.aws_s3_bucket.selected.bucket.id
lambda_function {
lambda_function_arn = aws_lambda_function.lambda_function.arn
events = [“s3:ObjectCreated:*”]
}
}