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 "tenant", "labels_as_tags", and "descriptors" #132

Merged
merged 8 commits into from
Aug 20, 2021
Merged

Add "tenant", "labels_as_tags", and "descriptors" #132

merged 8 commits into from
Aug 20, 2021

Conversation

Nuru
Copy link
Contributor

@Nuru Nuru commented Aug 17, 2021

what

  • Add additional label and id component: tenant
  • New input labels_as_tags controls which labels are exported as tags
  • New input descriptor_formats generates new output descriptors
  • Update README, remove link to obsolete terraform-terraform-label

why

  • Support users that host resources on behalf of and/or dedicated to single customers
  • Supersedes and closes Add a 'static_tags' option to disable automatic merging of tags #131, giving people control over which tags the module generates
  • Simple mechanism for creating multiple identifiers from the same inputs, reducing the need to create multiple instances of null-label
  • Document tenant, labels_as_tags, descriptor_formats, add additional clarification, stop promoting obsolete module

@Nuru Nuru requested a review from a team as a code owner August 17, 2021 01:18
osterman
osterman previously approved these changes Aug 17, 2021
@osterman
Copy link
Member

/test all

README.yaml Outdated Show resolved Hide resolved
README.yaml Outdated Show resolved Hide resolved
README.yaml Show resolved Hide resolved
aknysh
aknysh previously requested changes Aug 17, 2021
Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a few nitpicks

korenyoni
korenyoni previously approved these changes Aug 17, 2021
Copy link
Member

@korenyoni korenyoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I've added minor changes to language in both the README and the new tenant variable. Not a must, but I think it would be nice.

README.yaml Outdated Show resolved Hide resolved
README.yaml Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
examples/complete/context.tf Outdated Show resolved Hide resolved
exports/context.tf Outdated Show resolved Hide resolved
README.yaml Outdated Show resolved Hide resolved
Co-authored-by: Andriy Knysh <[email protected]>
Co-authored-by: Yonatan Koren <[email protected]>
@Nuru Nuru dismissed stale reviews from korenyoni and osterman via 59f0243 August 17, 2021 03:53
@Nuru
Copy link
Contributor Author

Nuru commented Aug 17, 2021

/test all

@Nuru Nuru requested review from aknysh and osterman August 18, 2021 00:40
@Nuru Nuru added the do not merge Do not merge this PR, doing so would cause problems label Aug 18, 2021
@korenyoni
Copy link
Member

/test all

@Nuru
Copy link
Contributor Author

Nuru commented Aug 20, 2021

/test all

@Nuru Nuru requested a review from korenyoni August 20, 2021 01:22
@Nuru Nuru removed the do not merge Do not merge this PR, doing so would cause problems label Aug 20, 2021
@Nuru Nuru dismissed aknysh’s stale review August 20, 2021 01:25

Concerns addressed

descriptors.tf Outdated Show resolved Hide resolved
examples/complete/label2.tf Outdated Show resolved Hide resolved
variables.tf Outdated Show resolved Hide resolved
main.tf Outdated
}

default_labels_as_tags = keys(local.tags_context)
# Unlike other inputs, the first setting of `labels_as_tags` cannot be later overridden
# We have to cover 2 cases. 1) context does not have a labels_as_tags key, 2) it is present and set to ["default"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a little confused about "default" and "unset" in labels_as_tags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hopefully clearer now.

Copy link
Member

@aknysh aknysh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please see comments

@Nuru Nuru requested a review from aknysh August 20, 2021 05:40
@Nuru
Copy link
Contributor Author

Nuru commented Aug 20, 2021

/test all

@Nuru Nuru changed the title Add "tenant" Add "tenant", "labels_as_tags", and "descriptors" Aug 20, 2021
aknysh
aknysh previously approved these changes Aug 20, 2021
Copy link
Member

@korenyoni korenyoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

The only change requested here is for a typo in README.yaml.

The rest are either nitpicks or suggestions for better documentation — both inline in the code and in README.yaml.

README.yaml Show resolved Hide resolved
README.yaml Outdated Show resolved Hide resolved
README.yaml Outdated Show resolved Hide resolved
README.yaml Outdated Show resolved Hide resolved
README.yaml Show resolved Hide resolved
README.yaml Outdated
becomes the new default for downstream modules. Also, collections are not overwritten, they are merged,
so once a tag is added, it will remain in the tag set and cannot be removed, although its value can
be overwritten.

Because the purpose of `labels_as_tags` is primarily to prevent tags from being generated
that would conflict with the AWS provider's `default_flags`, it is an exception to the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default_flags is a nonexistent AWS Provider argument — I'm sure you meant default_tags.

Suggested change
that would conflict with the AWS provider's `default_flags`, it is an exception to the
that would conflict with the AWS provider's `default_tags`, it is an exception to the

Secondly, "conflict with" might suggest that the AWS Provider would somehow error out if the tags exist in two places. At the very least, it doesn't explain which of these two — the AWS Provider or null-label — takes precedent. Consider writing the following, which explains the situation a little more specifically:

Suggested change
that would conflict with the AWS provider's `default_flags`, it is an exception to the
that would override tags specified in the AWS provider's `default_tags` argument, it is an exception to the

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the AWS provider errors out if the same tag is set in two places.

README.yaml Show resolved Hide resolved
examples/complete/module/compare/compare.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
@Nuru
Copy link
Contributor Author

Nuru commented Aug 20, 2021

/test all

@Nuru Nuru merged commit 503f50c into master Aug 20, 2021
@Nuru Nuru deleted the tenants branch August 20, 2021 18:46
Copy link
Member

@korenyoni korenyoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

README.yaml Show resolved Hide resolved
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.

5 participants