resource “aws_iam_policy” “template_policy” {
name = “{var.bucket_name}-policy"
path = "/"
description = "Policy allow S3 bucket access"
policy = templatefile("{path.module}/s3bucket.json”, {
bucket = var.bucket_name,
rules = [“PutObject”, “GetObject”, “DeleteObject”]
})
}
using this module but getting Error in function call
on main.tf line 6, in resource “aws_iam_policy” “template_policy”:
6: policy = templatefile(“${path.module}/s3bucket.json”, {
7: bucket = var.bucket_name,
8: rules = [“PutObject”, “GetObject”, “DeleteObject”]
9: })
|----------------
| path.module is “.”
Call to function “templatefile” failed: ./s3bucket.json:31,4-4: Unexpected end
of template; The for directive at ./s3bucket.json:22,17-40 is missing its
corresponding endfor directive…