How to populate the Secret Manager Notification Url with the API URL? The code below throws a circular reference. I have tried multiple !Sub but nothing seems to work
Resources:
SquareWebhookAuthorizerFunction:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
CodeUri: square-webhook-authorizer/
Handler: app.SquareWebhookAuthorizerFunction
Runtime: nodejs16.x
Environment:
Variables:
SignatureKey: !Sub '{{resolve:secretsmanager:${SquareSecret}:SecretString:SignatureKey}}'
NotificationUrl: !Sub '{{resolve:secretsmanager:${SquareSecret}:SecretString:NotificationUrl}}'
TABLE_NAME: !Ref SquareWebhookEventTable
Events:
SquareWebhookEvent:
Type: HttpApi # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
Properties:
Path: /
Method: POST
SquareSecret:
Type: AWS::SecretsManager::Secret
Properties:
Name: SquareSecretProxy
Description: "Square App Secrets"
SecretString: !Sub |
'{
"SignatureKey": "xxxx",
"NotificationUrl": https://${ServerlessHttpApi}.execute-api.${AWS::Region}.amazonaws.com/",
}'