-
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
Add tagging support for AWS ASG #1080
Conversation
Regarding
The current implementation is making it optional and defaulting to Shall we mimic the CF behavior and make it required then? Sometimes explicit is better than implicit I believe. |
Your synopsis nails my take on it :) I'm slightly pro explicit, but I don't have really strong feelings. |
b4a89fb
to
f0f24d3
Compare
// MapByKey returns the elements of this set as map with defined key | ||
// | ||
// Duplicate elements will be eliminated (last win) | ||
func (s *Set) MapByKey(key string) map[string]interface{} { |
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.
I think we should just move this out into a helper in the AWS provider. I don't see this as being generally useful enough to put onto the Set
directly.
One comment from me but this looks really, really good and will be much appreciated. As for your propagate behavior: I think this is correct. Thanks! |
f0f24d3
to
821e73c
Compare
Modified as requested = |
Can you rename |
After that, LGTM |
Do you want just the first character to be lowercase or the whole name? i.e. |
Just the first character. This is how Go knows whether to export it publicly or not. |
821e73c
to
f24b7a1
Compare
It's all fixed now. 😉 |
f24b7a1
to
2bfa907
Compare
👍 This works perfectly! |
66cc5dd
to
437a625
Compare
Hey @radeksimko it looks like c4ec8cf introduced significant changes, does the original description of the PR still hold up? Perhaps it was just a significant refactoring, I didn't see the original. Does this specific tag behavior apply to other resources, or is it just on ASGs? |
I think it's all up to date, the logic was mostly taken from the existing EC2-tagging logic, but I couldn't directly reuse that logic, see reasons below.
@catsby Good question, complicated answer below. EC2-related taggingExistingIt's worth pointing out that the existing
MissingHere's the full list of EC2 resources that can be tagged using the same API endpoint which means that we're missing tagging functionality in the EC2 world for these:
EC2-UNrelated tagsI think most of the resources having the simple tag structure as below 🔽 type Tag struct {
Key aws.StringValue `ec2:"Key" xml:"key"`
Value aws.StringValue `ec2:"Value" xml:"value"`
} may theoretically work with the existing tagging logic as long as we can abstract the EC2-specific API calls & data-types that we currently have in
Resources that would benefit from this as these have the same
EC2-UNrelated requiring extra careAll these will most likely require resource-specific code for handling tags
|
437a625
to
1d08ffb
Compare
@catsby Do you want me to create another issue from that last comment with a checklist or something? |
1d08ffb
to
9ecdf74
Compare
Any updates on merging this? We could really use tagging on ASGs (in the meantime, building Terraform from the fork is working for us). |
@radeksimko hey sorry for the silence here; I'm taking on Tagging now and tracking it internally, but your list is very similar so yeah, if you could make a separate issue with that last comment that would be great! We can track progress publicly that way. I just merged #1289 adding tags for ELB, and I've got a PR open for RDS (#1292). @jacobwgillespie re: merging this specific PR, I suspect it will happen this week, I need to take a closer look. I have plans for what @radeksimko mentioned in terms of consolidating the tagging files, right now I'm duplicating them to get things rolling but we'll merge them into something generic soon. |
@@ -195,6 +202,7 @@ func resourceAwsAutoscalingGroupRead(d *schema.ResourceData, meta interface{}) e | |||
d.Set("min_size", *g.MinSize) | |||
d.Set("max_size", *g.MaxSize) | |||
d.Set("name", *g.AutoScalingGroupName) | |||
d.Set("tag", g.Tags) |
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.
@radeksimko coupla notes on d.Set
- It returns an
error
, which generally we don't check, except in the case when the value we're setting is complex. So this"tag"
case is one where I'd check the error return value. - As of recently it got the ability to handle pointer dereferencing internally with proper nil checking, so can you remove the dereferencing from the other
d.Set
calls here?
👯
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.
ok, I will have a look at that probably tomorrow.
Generally looking good! One comment for you. |
@catsby awesome, thanks! 👍 |
9ecdf74
to
7950ace
Compare
Closing in favor of #1319 |
I just merged #1319, a continuation of this PR, so this is effectively merged. Thanks everyone! Special thanks to @radeksimko for doing all the hard work 😄 |
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. |
This is fixing #932
I'm aware of #1076 but the implementation is not as easy as @bobtfish think it is 😉
The
autoscaling.CreateOrUpdateTags
endpoint does not remove tags (as the name suggests), there's another endpointautoscaling.DeleteTags
for this. Therefore we need to do all the diffing and call correct endpoints with correct data when updating.Updated tests + documentation attached.
I intentionally used
tag
(singular) as it IMO makes more sense -> it's similar to ELB'slistener
.Here's an example: