Trying to set up a SNS email subscription and I se...
# general
f
Trying to set up a SNS email subscription and I see this in the docs for `TopicSubscriptionArgs`:
Copy code
/**
     * The protocol to use. The possible values for this are: `sqs`, `sms`, `lambda`, `application`. (`http` or `https` are partially supported, see below) (`email` is option but unsupported, see below).
     */
    readonly protocol: pulumi.Input<string>;
What does "(
email
is option but unsupported, see below)" mean? How am I supposed to create an email subscription?
s
Not as far as I’m aware right now
It’s been a limitation of Terraform forever
f
So how do people set up CloudWatch alarms with email? Do users typically do this manually?
s
My guess is manually, I’ve never actually tried it though
f
Seems like the workaround is to use a CF stack to create the subscription: http://aws-cloud.guru/terraform-sns-topic-email-list/. Nasty but will probably work.
s
Ugh, that sucks. I wonder if we can do better here. It’s conceivable that there are other workflows since that was done in Terraform (similar to ACM etc)
f
It may be possible to wrap a CF template, similar to what the awsx.Cluster.createAutoScalingGroup does.
Will try something like this:
Copy code
function snsEmailSubscription(topicArn: string, email: string) {
    return new aws.cloudformation.Stack("alert-email-subscribe", {
        templateBody: JSON.stringify({
            "AWSTemplateFormatVersion": "2010-09-09",
            "Resources": {
                "EmailSNSTopic": {
                    "Type": "AWS::SNS::Subscription",
                    "Properties": {
                        "TopicArn": topicArn,
                        "Protocol": "email",
                        "Endpoint": email
                    }
                }
            }
        }),
        capabilities: ["CAPABILITY_NAMED_IAM"]
    })
}
s
This is probably the kind of thing we should consider adding to
awsx
itself, too (cc @white-balloon-205)
f
FWIW, the above snippet works nicely.