-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 support for collect_ec2_tags
and collect_security_groups
options
#1194
Conversation
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.
This should be updated too
datadog-agent/pkg/legacy/converter.go
Line 54 in b219d79
// TODO: collect_ec2_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.
Also, change these to True
to confirm it works
datadog-agent/pkg/legacy/tests/datadog.conf
Lines 50 to 53 in b219d79
# Collect AWS EC2 custom tags as agent tags (requires an IAM role associated with the instance) | |
collect_ec2_tags: False | |
# Incorporate security-groups into tags collected from AWS EC2 | |
# collect_security_groups: False |
c64bfd1
to
71dfa98
Compare
if !config.Datadog.GetBool("collect_security_groups") { | ||
// remove the `security_group_name` tag if present | ||
for i, s := range ec2Tags { | ||
if strings.HasPrefix(s, "security_group_name:") { |
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.
@arbll if you look at the A5 logic: https://github.com/DataDog/dd-agent/blob/5.21.2/utils/cloud_metadata.py#L212-L214 it looks like the security_group_name tag is not part of the tags that are returned by the AWS API, but that we extract the tag from the instance metadata and append it to the list of tags. So we should probably do the same thing in A6 so that users who do have the collect_security_groups option enabled have the tag with A6.
What do you think?
How do we specify this tag from the Docker image? In the old one, we were able to specify this: EC2_TAGS = "yes" |
Hi @joshk0 thanks for reaching out. |
What does this PR do?
Adds support for
collect_ec2_tags
andcollect_security_groups
config options.Motivation
Avoid context churn on A5=>A6 update.