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

Allow customizing the default target group name, target type, and tags #29

Merged
merged 5 commits into from
Oct 18, 2019

Conversation

stangles
Copy link
Contributor

@stangles stangles commented Oct 1, 2019

This adds 3 new variables (with original defaults to maintain backwards compatibility with older module versions) to the default target group.

  1. target_group_name - while the default naming scheme enforced by the null-label is nice, I have found valid use cases for specifying a more descriptive custom name for the default target group (while still preserving the naming scheme for the actual ALB).
  2. target_group_target_type - AWS has three options for target group types, this allows for specifying an option other than the hardcoded ip.
  3. target_group_tags - before this change, the default target group did not have its tags set by the module. This updates it to either optionally pass in your own set of tags (something that I think is useful, just like being able to specify your own target group name) or use the tags passed in to the module that are also applied to the ALB.

main.tf Outdated
@@ -108,6 +108,8 @@ resource "aws_lb_target_group" "default" {
lifecycle {
create_before_destroy = true
}

tags = "${length(var.target_group_tags) == 0 ? module.default_target_group_label.tags : var.target_group_tags}"
Copy link
Member

Choose a reason for hiding this comment

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

why not provide your custom tags in var.tags?
Those will be merged in label module with the a few tags generated by the label module.
(unless you want a completely separate set of tags. What's the use case?)

Copy link
Contributor Author

@stangles stangles Oct 1, 2019

Choose a reason for hiding this comment

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

why not provide your custom tags in var.tags?

The custom tags are specific to the particular target group and would not make sense being applied to the ALB resource. In my particular case, I want to use a terraform data source to find a target group by a tag specific to the particular kind of workload that will be registered with that target group. Perhaps a compromise might be renaming this target_group_additional_tags and merging whatever is passed in with the label tags?

Copy link
Member

Choose a reason for hiding this comment

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

yes, add target_group_additional_tags variable, then merge it with label.tags (not var.tags, those are included in the label.tags - and use the resulting map for the target group 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.

add target_group_additional_tags variable, then merge it with label.tags

done d5c7a49

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.

thanks @stangles

Looks good, but please see the comments and please rebuild README by executing these commands:

make init
make readme/deps
make readme

It will add the new variables and outputs to README.md automatically.

In general, any changes to README should be made in README.yaml (not in this case), and after that executing the commands above will rebuild README.yaml into README.md and add all new variables and outputs to README.md

thanks

@stangles
Copy link
Contributor Author

stangles commented Oct 1, 2019

please rebuild README by executing these commands

I ran the commands you specified and updated them in 80b2332

It appears there are some unrelated refactorings to the README to source images from a different location, hopefully that's acceptable.

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.

thanks @stangles

@aknysh aknysh merged commit f96dc18 into cloudposse:master Oct 18, 2019
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.

None yet

2 participants