cool-helicopter-70130
10/02/2018, 7:45 AMMalformedPolicyDocument: Syntax errors in policy.
, and indeed the policy looks completely wrong {"Version":"2012-10-17","Statement":[{"Action":"lambda:InvokeFunction","Effect":"Allow","Resource":{"__pulumiOutput":true,"isKnown":{}}}]}
.const invocationPolicy = new aws.iam.RolePolicy(`${apiName}-authorizer-invoke-lambda-role-policy`, {
role: invocationRole,
policy: JSON.stringify({
"Version": "2012-10-17",
"Statement": [
{
"Action": "lambda:InvokeFunction",
"Effect": "Allow",
"Resource": authorizerLambda.arn // <==== HERE
}
]
}),
}, { dependsOn: authorizerLambda }); // <=== I tried adding this to see if it would help
.apply()
like so:
policy: authorizerLambda.arn.apply(arn => JSON.stringify({
"Version": "2012-10-17",
"Statement": [
{
"Action": "lambda:InvokeFunction",
"Effect": "Allow",
"Resource": arn
}
]
})),
white-balloon-205
apply
is the key to taking an output from one resource and using it to construct an input for another (in this case the policy document). Glad you found the answer - we know we need more docs on this!