-
Notifications
You must be signed in to change notification settings - Fork 33
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
Support new YAML template features #31
Comments
Actually, I see no advantage in uploading the original YAML to CloudFormation, do you? |
Perfect, thanks Mike. |
I've reopened this because, while we already support YAML, we don't support the new "abbreviated syntax for tags", e.g. |
I'm not sure how much of an advantage it is but if a template is uploaded in YAML, |
@lukeck: Damn. If that's true it means we probably can't away with converting the template into a canonical form (i.e. data) within Stackup; instead, we'll have to retain the original template text. |
This thread is relevant to my interests. |
I'm kind of pissed at the way AWS have chosen to use (abuse?) YAML tags, in their adoption of YAML, e.g. Outputs:
LoadBalancerAddress:
Value: !GetAtt
- LoadBalancer
- DNSName as a shorthand for Outputs:
LoadBalancerAddress:
Value:
Fn::GetAtt:
- LoadBalancer
- DNSName As I understand it, tags are intended to denote types. The really annoying thing is that the first example above doesn't even round-trip via YAML!
FFS! I wish they'd just treated YAML as an alternative serialisation format. Anyway, If we want Stackup to support the new syntax, we have two options: A. retain input template format/body (awscli-compatible) Option A: retain input template formatTo be fully compatible with what the AWS CLI (now) does, we'd have to retain the original YAML template text, and send it intact up to CloudFormation. As a result:
Option B: parse-time conversionA simpler change is to stick with our current approach - converting the input JSON/YAML to data within Stackup - and just add some magic to convert the tags to their equivalent JSON-compatible forms, e.g.
|
I'm not in love with option A but option B looks like it's a recipe for an ongoing headache. |
I'm not sure it's that much of an ongoing headache, @lukeck. The logic I've implemented in #32 is basically:
See Lines 46 to 55 in 3b028a6
|
Closed with #32. |
Stackup's implementation doesn't seem to support YAML AWS pseudo-parameter substitution via SubscribeLambda:
Type: "AWS::SNS::Subscription"
Properties:
Endpoint: !Sub |
arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:addBuyProfile
Protocol: lambda
TopicArn: !Sub |
arn:aws:sns:${AWS::Region}:${AWS::AccountId}:cbr-profiler I concur with @lukeck assessment that option (b) will be a headache, due to this sort of thing |
Additionally, there seems to be a trailing newlines that gets inserted into ARN strings in YAML, making them fail AWS validation Template: Resources:
SnsPermission:
Type: "AWS::Lambda::Permission"
Properties:
Action: lambda:InvokeFunction
FunctionName: !Sub |
arn:aws:lambda:ap-southeast-2:123456789012:function:myLambda
Principal: sns.amazonaws.com
SourceArn: !Sub |
arn:aws:sns:ap-southeast-2:123456789012:*
Result (note the newline that has been retained at end of ARN is whats failing the regex validation)
|
It should support SubscribeLambda:
Type: "AWS::SNS::Subscription"
Properties:
Endpoint: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:addBuyProfile
Protocol: lambda
TopicArn: !Sub arn:aws:sns:${AWS::Region}:${AWS::AccountId}:cbr-profiler If that still doesn't work, please raise a separate issue. |
CloudFormation Now Supports YAML.
Looks like stackup will need some design and then development given its strict JSON template handling: https://github.com/realestate-com-au/stackup/blob/master/lib/stackup/stack.rb#L115 (as an example)
Im going to have a look into converting a small stack in the next week or so, and will try attempt a YAML stackup refactor with that stack in both JSON and YAML. I'll at least try and provide any relevant info if and when possible.
References
Jeff's blog and release notes:
https://aws.amazon.com/blogs/aws/aws-cloudformation-update-yaml-cross-stack-references-simplified-substitution/
CloudFormation Formats documentation:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-formats.html
The text was updated successfully, but these errors were encountered: