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
Reference CF resources attributes in serverless.yml #3426
Comments
Did you try to set the environment variable as GetAtt ?
|
This is an old ticket (and can probably be closed), but I found this helpful. If you're trying to reference a parameter that you define in your resource, you can use the variable substitution: functions:
myFunction:
...
environment:
QUEUE_NAME: ${self:resources.Resources.MyQueue.Properties.QueueName}
...
resources:
Resources:
MyQueue:
...
Properties:
QueueName: MyQueuesName If you need to access one of the resource's outputs (like its ARN), you can use the the |
Can this be resolved by Referencing CloudFormation Outputs and closed? |
I don't thinks so @exoego. He's using cfn references within the same stack, not exports. |
Don't we have the |
@pmuens that syntax is for interacting with stack exports |
I also need to do something like that.
but it errors out with:
Setting an environment variable with the exact same construct works without problems, though. I dont get why using getAtt for an environment var works, and using it for filling in a cors origin doesn't... |
@mthenw did you ever find a clean solution to this problem? |
@mckennajones not really :) |
The I'm getting this error:
|
Closing, as I believe it's possible now either by using CF intrinsic functions, or simply relying on @mthenw If I miss something, please explain in more detail. @aequasi I believe issue you were having was addressed with #8307 |
Just to expand on @mfulgo 's answer, in a provider: {
// ...
iam: {
role: {
statements: [
{
Effect: 'Allow',
Action: ['your:action'],
Resource: { 'Fn::GetAtt': ['NotificationsQueue', 'Arn'] }, // <-- this
},
],
},
},
}
resources: {
Resources: {
NotificationsQueue: {
Type: 'AWS::SQS::Queue',
// ...
},
},
}, |
Note that none of the previously proposed solutions/workarounds work if one needs to use the For example, given the following resource in
Attempting to reference the above within the same
|
This is a Feature Proposal
Description
Let say I have a service that uses RDS MySQL DB
The problem is that I cannot use return values from this resource and use it in function/service config.
AWS::RDS::DBCluster
has two return attributesEndpoint.Address
&Endpoint.Port
. Right now the only way is to copy/paste this value. It's a huge blocker for automated deployments.Maybe something like
${self:resources.DBCluster.Endpoint.Address}
?The text was updated successfully, but these errors were encountered: