Hello, I'm trying to create a new AWS role policy ...
# aws
s
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
Try writing a Python map and use
json.dumps
. that way you're (nearly) guaranteed to get valid JSON.
b
isn’t this C# ?
s
It is F# actually.
b
i can’t see any issue with the JSON 😞