Skip to content
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

Merged
merged 4 commits into from
Feb 8, 2018

Conversation

arbll
Copy link
Member

@arbll arbll commented Feb 6, 2018

What does this PR do?

Adds support for collect_ec2_tags and collect_security_groups config options.

Motivation

Avoid context churn on A5=>A6 update.

@arbll arbll requested a review from a team as a code owner February 6, 2018 16:09
Copy link
Contributor

@ofek ofek left a 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

// TODO: collect_ec2_tags

Copy link
Contributor

@ofek ofek left a 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

# 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

@arbll arbll force-pushed the arbll/config-aws-tags branch from c64bfd1 to 71dfa98 Compare February 8, 2018 14:30
@arbll arbll merged commit ca6610b into master Feb 8, 2018
@arbll arbll deleted the arbll/config-aws-tags branch February 8, 2018 14:45
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:") {
Copy link
Member

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?

@joshk0
Copy link

joshk0 commented Mar 22, 2018

How do we specify this tag from the Docker image? In the old one, we were able to specify this: EC2_TAGS = "yes"

@arbll
Copy link
Member Author

arbll commented Mar 22, 2018

Hi @joshk0 thanks for reaching out.
You're right, setting this option using an environment variable is missing, adding to our backlog.
It should be available in 6.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants