-
Couldn't load subscription status.
- Fork 2.4k
Description
I took a look into the Alarm error from #350.
I replicated the reported issue by using an Fn::If intrinsic in the Alarms section of my template:
...
Alarms:
Fn::If:
- IsBetaStage:
- - { Ref: IncreasedFaults }
- { Ref: IncreasedLatency }
- - { Ref: IncreasedFaults2 }
- { Ref: IncreasedLatency2 }
...This resulted in the following JSON definition:
"AlarmConfiguration": {
"Alarms": [
{
"Name": "Fn::If"
}
],
"Enabled": true
}, It looks like SAM is trying to provide shorthand syntax for supporting alarms; when SAM transforms this section, it needs to transform the alarms to be Name: <alarm-name>.
SAM does this transformation here: https://github.com/awslabs/serverless-application-model/blob/master/samtranslator/model/preferences/deployment_preference_collection.py#L104
A possible fix might be to explicitly add support for Fn::If for this property. If Fn::If is encountered here, we need to do the Name: <alarm-name> transformation on all items inside of the conditional. This would also need to be aware of other values common to Fn::If, like AWS::NoValue.
Originally posted by @keetonian in #350 (comment)