-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add AutoScaling Example With Scaling Rules and Notifications #459
base: main
Are you sure you want to change the base?
Conversation
To make it easier to see how I changed the original Amazon template, here is the diff:
|
I like the example and think it is good to add it. The issue I'm wrestling with is whether adding Comment would lead to confusion since it will only work in a Metadata attribute and people might try using it in other objects. Let me ponder this one for a bit more. |
It looks like As you pointed out, every Metadata attribute can have a Comment key, but Comment is not a attribute for every resource. What is the best way to put Comment inside of Metadata? When I search the troposphere code base I find Metadata in Instead of |
As you pointed out Metadata is in some of the existing objects. I'll have to spend some time looking at git history to try to figure out why/when those were added. This is sometimes difficult given the lack of historical docs. Given that Metadata is really just a json blob we could remove Comment and just attach and arbitrary dict instead. Or just leave Comment as-is in your PR and see what happens. I'm leaning towards the latter but still thinking about it. I understand your comment about adding Metadata to every BaseAWSObject but wondering if the complexity is worth it for this issue. |
I tried adding the Comment using a variety of formats around commit 7a8026d, but it wouldn't build or pass tests (I can't remember which). Whichever way you decide, let me know and I can adjust the PR. I might try a POC for making Metadata more robust. |
Doing some digging I found the following issues related to Metadata:
Unfortunately, this exercise did not give me an opinion on which way to move forward. I'm sharing the links as it may be useful to you. |
Is this PR still relevant? If not, I'll close it out. |
Add AutoScalingMultiAZWithNotifications.template example https://s3-us-west-2.amazonaws.com/cloudformation-templates-us-west-2/AutoScalingMultiAZWithNotifications.template
The AWS example template as a Comment key in the Metadata of the cloudformation template. I added a Comment class to create this object.
According to the Cloudformation documentation, "AWS::AutoScaling::AutoScalingGroup" types have a property "NotificationConfigurations" that is a list. The original template has the singular and it isn't a list. Troposphere wouldn't build the template using this property.
Adjust line lengths to match 79 character preference
The failure is in
If there is any interest in this let me know and I'll figure out how to update the tests to match the current code base. Otherwise I'll just close it. |
This pull requests creates an example troposphere script that creates the AutoScalingMultiAZWithNotifications.template.
In order to create a comment that was in the example CloudFormation template, I added a
Comment
class totroposphere/cloudformation.py
. I am not sure if this is the right place. I was able to create the template when I added the same class totroposphere/__init__.py
. I did not ultimately choose that location because I do not know if theComment
property is universal to all resources in CloudFormation templates.Perhaps I should of done with the
Comment
property what I had to do with theNotificationConfigurations
property in theAutoScalingGroup
resource, namely edit the template to match the troposphere code. I could not create theNotificationConfigurations
without passing it a list, which is supported by the AWS AutoScalingGroup documentation.