-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
provider/aws: Autoscaling Metrics Collection resource #4688
Conversation
@@ -253,6 +260,10 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e | |||
d.Set("vpc_zone_identifier", strings.Split(*g.VPCZoneIdentifier, ",")) | |||
d.Set("termination_policies", g.TerminationPolicies) | |||
|
|||
if g.EnabledMetrics != nil { | |||
d.Set("enabled_metrics", flattenAsgEnabledMetrics(g.EnabledMetrics)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check the error on this, recently bit by this
This looks good! I have some questions/comments but other than that 👍 |
@@ -746,3 +747,13 @@ func flattenCloudFormationOutputs(cfOutputs []*cloudformation.Output) map[string | |||
} | |||
return outputs | |||
} | |||
|
|||
func flattenAsgEnabledMetrics(list []*autoscaling.EnabledMetric) []string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if possible, we should add a test for this in structure_test.go
4eb369b
to
da0bffa
Compare
da0bffa
to
4fc1391
Compare
This is ready for final review. Metrics can only be enabled / updated / disabled for an ASG. There is no way that there can be multiple terraform configs for an ASG metrics collection |
This makes me rethink the utility of having this as a separate resource. Seems like it just makes for possible confusion if a user accidentally has two of these floating around in the same config. Whereas if they were just fields on the ASG there's no possibility for confusion: resource "aws_autoscaling_group" "foo" {
metrics = [...]
metric_granularity = "1Minute"
} That seems much simpler to me - happy to discuss further though! |
@phinze having it as a separate resource allows the user to start managing the metrics for non-managed terraform resources now |
Ah yes this is true! Though I think that argument could be made for any pair of separated API requests. e.g. we have to call I don't think partially managing resources is necessarily a good enough reason to keep the separation, especially when the relationship is so 1:1. Handling these fields just like the |
@phinze combining now :) |
Autoscaling Group
@phinze merged the resources so ready for you when you want :) |
Solid, LGTM! |
jsut a FYI for the PR
|
provider/aws: Autoscaling Metrics Collection resource
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Scaffold the AWS Autoscaling Group Metrics Collection - #4683
Decided to make this as a separate resource to allow simple manipulation of the metrics collected without needing to change the Autoscaling Group. Added a computed type to the autoscaling group to add the enabled_metrics to the asg state
Test results: