early-keyboard-41388
09/19/2022, 4:56 PMlambda.Permission
for an Api Gateway call with stageVariables
, but getting an error in the function
name.
new aws.lambda.Permission(
'permission-resource,
{
action: 'lambda:InvokeFunction',
function: interpolate`arn:aws:lambda:${awsRegion}:${callerIdentityOutput.accountId}:function:${apiLambda.name}:\${stageVariables.GRAPHQL_ALIAS}`,
principal: '<http://apigateway.amazonaws.com|apigateway.amazonaws.com>',
sourceArn: interpolate`arn:aws:execute-api:${awsRegion}:${callerIdentityOutput.accountId}:${this.api.id}/*/${postMethod.httpMethod}${resource.path}`,
},
{ parent: postMethod },
);
The the addition of ${stageVariables.GRAPHQL_ALIAS}
is not working.
How is it done correctly?aws lambda add-permission --function-name "arn:aws:lambda:<region>:<account>:function:graphql:${stageVariables.GRAPHQL_ALIAS}" --source-arn "arn:aws:execute-api:<region>:<account>:<resource>/*/POST/graphql" --principal <http://apigateway.amazonaws.com|apigateway.amazonaws.com> --statement-id <statement_id> --action lambda:InvokeFunction
Got this from the AWS console (Api Gateway) for adding the lambda with the ${stageVariables}
in it.witty-candle-66007
09/19/2022, 4:59 PMearly-keyboard-41388
09/19/2022, 5:00 PMstageVariables
out of the stage.
Like from here: https://docs.aws.amazon.com/apigateway/latest/developerguide/amazon-api-gateway-using-stage-variables.htmlwitty-candle-66007
09/19/2022, 5:01 PMexport const goo = pulumi.concat("arn:aws:lambda:",aws.config.region,"blah blah ${stageVariables.GRAPHQL_ALIAS}:",bucket.id)
export const foo = pulumi.interpolate `arn:aws:lambda:${aws.config.region} blah blah \$\{stageVariables.GRAPHQL_ALIAS\}:${bucket.id}`
`early-keyboard-41388
09/19/2022, 5:11 PM:\${stageVariables.GRAPHQL_ALIAS}
Do it like this?
:\$\{stageVariables.GRAPHQL_ALIAS\}
Permission
for the lambda with the alias as the stageVariables
, it fails due to
"function_name" doesn't comply with restrictions
.
Maybe I’m using the wrong resource to do it..witty-candle-66007
09/19/2022, 5:22 PM