-
Notifications
You must be signed in to change notification settings - Fork 4.4k
sns: support cross-region subscriptions #13707
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-sns-subscriptionsclosed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.This issue was automatically closed because it hadn't received any attention in a while.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p1
Description
When creating an SNS subscription in a region different from the SNS topic's region, there is a Region property in the CloudFormation resource that is not being set.
Reproduction Steps
sealed class Program
{
public static void Main(string[] args)
{
var app = new App();
var snsStack = new SnsStack(app, "Sns", new StackProps
{
Env = new Environment
{
Account = "XXXXXXXXXXXX",
Region = "us-east-1",
}
});
var lambdaStack = new LambdaStack(app, "Lambda", new StackProps
{
Env = new Environment
{
Account = "XXXXXXXXXXXX",
Region = "us-west-2",
}
}, snsStack);
}
public class SnsStack : Stack
{
public readonly ITopic Topic;
public SnsStack(Construct scope, string id, StackProps props) : base(scope, id, props)
{
Topic = new Topic(this, "Topic", new TopicProps { TopicName = PhysicalName.GENERATE_IF_NEEDED, });
}
}
public class LambdaStack : Stack
{
public readonly IFunction Function;
internal LambdaStack(Construct scope, string id, StackProps props, SnsStack snsStack) : base(scope, id, props)
{
Function = new PythonFunction(this, "Function", new PythonFunctionProps
{
Entry = "src/CdkSnsCrossRegion/Function",
});
snsStack.Topic.AddSubscription(new LambdaSubscription(Function));
}
}What did you expect to happen?
Expected Region property to be set in AWS::SNS::Subscription resource.
{
"FunctionTopicD77BEC18": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Protocol": "lambda",
"TopicArn": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":sns:us-east-1:XXXXXXXXXXXX:snssnstopic2f96c0ab8390dbda1164"
]
]
},
"Endpoint": {
"Fn::GetAtt": [
"Function76856677",
"Arn"
]
},
**"Region": "us-east-1"**
},
},
}What actually happened?
Region property of AWS::SNS::Subscription is not set.
{
"FunctionTopicD77BEC18": {
"Type": "AWS::SNS::Subscription",
"Properties": {
"Protocol": "lambda",
"TopicArn": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":sns:us-east-1:XXXXXXXXXXXX:snssnstopic2f96c0ab8390dbda1164"
]
]
},
"Endpoint": {
"Fn::GetAtt": [
"Function76856677",
"Arn"
]
}
},
},
}Environment
- CDK CLI Version : 1.94.1 (build 60d8f91)
- Framework Version: 1.94.1
- Node.js Version: v12.16.3
- OS : macOS 10.13.6
- Language (Version): net5.0
Other
Possibly related:
I looked at the source and it seemed fine. Perhaps I'm missing something really obvious or the usage is incorrect?
This is 🐛 Bug Report
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-sns-subscriptionsclosed-for-stalenessThis issue was automatically closed because it hadn't received any attention in a while.This issue was automatically closed because it hadn't received any attention in a while.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortfeature-requestA feature should be added or improved.A feature should be added or improved.p1