serverless-plugin-aws-alerts
serverless-plugin-aws-alerts copied to clipboard
`Ref` a topic created in Resources
This is a Feature Proposal
Description
Being able to reference a topic created by a CloudFormation template.
custom:
alerts:
topics:
ok:
Ref: SNSTopic
alarm:
Ref: SNSTopic
insufficientData:
Ref: SNSTopic
resources:
Resources:
SNSTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: ${self:service}-${opt:stage}
Subscription:
- Endpoint: https://api.opsgenie.com/v1/json/cloudwatch?apiKey=${ssm:/opsgenie/${opt:stage}/api_key}
Protocol: HTTPS
In some cases, I just want to Ref
my SNS topic as I might also be using that ARN somewhere else in my stack.
I have a PR, ready and tested.
Thanks Julien
That said, I have found a workaround my issue by naming my Topic and manually building the ARN with the help of the serverless-pseudo-parameters
plugin.
It's not very elegant, but it works...
plugins:
- serverless-plugin-aws-alerts
- serverless-pseudo-parameters
custom:
alerts:
topics:
ok: arn:aws:sns:${self:provider.region}:#{AWS::AccountId}:${self:service}-${self:provider.stage}
alarm: arn:aws:sns:${self:provider.region}:#{AWS::AccountId}:${self:service}-${self:provider.stage}
insufficientData: arn:aws:sns:${self:provider.region}:#{AWS::AccountId}:${self:service}-${self:provider.stage}
resources:
Resources:
SNSTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: ${self:service}-${self:provider.stage}
TopicName: ${self:service}-${self:provider.stage}
Subscription:
- Endpoint: https://api.opsgenie.com/v1/json/cloudwatch?apiKey=${ssm:/opsgenie/${opt:stage}/api_key}
Protocol: HTTPS
Two years later - what can we do to get this in? This is a pretty important feature to have.