Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Fn::ImportValue for sns and streams #3195

Closed
konstantinvlasenko opened this issue Feb 5, 2017 · 2 comments
Closed

Use Fn::ImportValue for sns and streams #3195

konstantinvlasenko opened this issue Feb 5, 2017 · 2 comments

Comments

@konstantinvlasenko
Copy link

konstantinvlasenko commented Feb 5, 2017

This is a Feature Proposal

Description

It is nice that we have the option to specify an ARN of existing sns or DynamoDB stream. This approach is good for pets but not for cattle. We don't provide the names for our resources. Hardcoded string inside a serverless.yml doesn't work for us.

For feature proposals:

@konstantinvlasenko konstantinvlasenko changed the title Use Fn::ImportValue for sns and streams Use Fn::ImportValue for s3, sns and streams Feb 5, 2017
@konstantinvlasenko konstantinvlasenko changed the title Use Fn::ImportValue for s3, sns and streams Use Fn::ImportValue for sns and streams Feb 5, 2017
@pmuens
Copy link
Contributor

pmuens commented May 22, 2017

Thanks for the suggestion @konstantinvlasenko 👍

Closing this issue since we're discussing a global arn parser in #3212

@pmuens pmuens closed this as completed May 22, 2017
@manwaring
Copy link

I encountered the same limitation this past week and have been thinking about ways to work around it. Using the $(cf) variable syntax allows me to pass in the arn correctly but by evaluating and injecting the string directly I lose the benefit of CloudFormation enforcing referential integrity with that approach (e.g. I can modify/delete the referenced resource even though resources in another stack depend on it). I would much prefer to use the Fn::ImportValue syntax to prevent accidental modification/deletion from happening.

Stream events already support both Fn::GetAtt as well as Fn::ImportValue via the code block below, and something similar could easily be implemented for SNS.

const streamName = (function () {
  if (EventSourceArn['Fn::GetAtt']) {
    return EventSourceArn['Fn::GetAtt'][0];
  } else if (EventSourceArn['Fn::ImportValue']) {
    return EventSourceArn['Fn::ImportValue'];
  }
  return EventSourceArn.split('/')[1];
}());

@pmuens it looks like the global arn parser feature (proposed just over a year ago) is on hold / waiting for support. In the meantime, would you be open to a feature proposal to bring intrinsic function support to SNS events the same way that it has been implemented for stream events? It's not as universally beneficial as the universal arn parser, obviously, but it follows an existing pattern and is much simpler to implement in the here and now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants