`condition` doesn't affect resources directly associated to resource on which is set
See original GitHub issueFeature Request
Description
Since #6642, Serverless supports conditional function generation.
When a function has http
events, the function is conditional but API Gateway resources are always generated (In the generated CloudFormation template, only the “AWS::Lambda::Function” resource has Condition
property but “AWS::ApiGateway::Method” resources have not).
functions:
func1:
handler: handler1
condition: IsDevelopment
events:
- http: GET hello
resources:
Conditions:
IsDevelopment:
Fn::Equals: [ "${self:provider.stage}", "dev" ]
If a function is conditional, the corresponding http event resources should also be conditional.
Similar or dependent issues:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Conditions - AWS CloudFormation
Declare conditions to conditionally create resources by using intrinsic functions in the Conditions section of a template.
Read more >Determine causes of non-compliance - Azure Policy
When a resource is non-compliant, there are many possible reasons. Discover what caused the non-compliance quickly and easily.
Read more >Working with Resource Monitors
If this property is not set, the resource monitor doesn't monitor any ... when Snowflake suspends the warehouses associated with the resource monitor, ......
Read more >Operating Systems: Deadlocks
A wait-for graph can be constructed from a resource-allocation graph by eliminating the resources and collapsing the associated edges, as shown in the...
Read more >Plan Participants - General Distribution Rules
(i) receive the distribution directly, or (ii) make an election to roll over the amount to an eligible retirement plan, the plan administrator...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Aposhian I think we may add support for auto assigning the conditions to tightly related resources, but only in case they’re safe
e.g. it’s not safe for API Gateway resources, but it’s safe for e.g. Version or EventSourceMapping resource.
Additionally we may show a log notice if conditions are used with API Gateway, to indicate that those resources cannot be reliably conditioned
PR that implements that in a manner specified here: https://github.com/serverless/serverless/issues/7070#issuecomment-630721129 is definitely welcome
For those coming here and looking for a solution while this issue isn’t fixed: I ran into the same issue and found https://www.serverless.com/plugins/serverless-plugin-conditional-functions to be an easy workaround for now.