https://pulumi.com logo
#aws
Title
# aws
s

sticky-jordan-27156

09/23/2022, 8:14 AM
Hello, I'm trying to create a new AWS role policy but something is wrong in my json:
Copy code
let _policy =
        let args =
            Iam.RolePolicyArgs (
                Policy =
                    input
                        """
{
    "Version": "2012-10-17",
    "Statement": [{
        "Effect": "Allow",
        "Action": [
            "logs:CreateLogGroup",
            "logs:CreateLogStream",
            "logs:PutLogEvents"
        ],
        "Resource": "arn:aws:logs:*:*:*"
    }]
}
""",
                Role = io lambdaRole.Id
            )

        Iam.RolePolicy ($"{loweredProjectName}-log-policy", args)
Leads to
Copy code
aws:iam:RolePolicy (autograph-log-policy):
    error: aws:iam/rolePolicy:RolePolicy resource 'project-log-policy' has a problem: "policy" contains an invalid JSON policy. Examine values at 'RolePolicy.Policy'.
I'm not sure why. Any ideas?
s

stocky-restaurant-98004

09/23/2022, 2:12 PM
Try writing a Python map and use
json.dumps
. that way you're (nearly) guaranteed to get valid JSON.
b

billowy-army-68599

09/23/2022, 3:04 PM
isn’t this C# ?
s

sticky-jordan-27156

09/23/2022, 3:14 PM
It is F# actually.
b

billowy-army-68599

09/23/2022, 3:15 PM
i can’t see any issue with the JSON 😞