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

feat: vpc endpoint names #560

Closed
wants to merge 4 commits into from
Closed

feat: vpc endpoint names #560

wants to merge 4 commits into from

Conversation

ChrisTiffin
Copy link

Description

This PR adds a Name tag to any vpc endpoints that are created by the module.

At the moment vpc endpoints are passed tags from local.vpce_tags; this change merges in a Name tag (based on var.name and the endpoint service's name) following the same pattern used throughout the rest of the module.

Motivation and Context

This will add more context to any vpc endpoints in the aws console, as well as allowing any testing tools that rely on the Name tag (such as awspec) to pick endpoints up for testing.

Breaking Changes

None known.

How Has This Been Tested?

Using terraform 0.13.3 I've deployed the module into an aws account with all endpoints enabled; checking that the deployment was successful and that the endpoints were named as I expected.
The endpoints were enabled in two batches, i.e. from access_analyzer to elasticbeanstalk_health, and then from elasticloadbalancing to workspaces, as aws has a 50 vpc endpoint limit by default.

adding name tag based on var.name and the endpoint service's name
@chrismazanec
Copy link

perhaps you could reference the data source instead of hard coding the name?

  tags = merge(
    {
      "Name" = format("%s-%s", var.name, data.aws_vpc_endpoint_service.s3[0].service)
    },
    local.vpce_tags,
  )

@bryantbiggs
Copy link
Member

thanks for the PR @cjtiffin - I'll take a look today

@bryantbiggs bryantbiggs self-assigned this Feb 22, 2021
{
"Name" = format("%s-%s", var.name, data.aws_vpc_endpoint_service.s3[0].service)
},
local.vpce_tags
Copy link
Member

@bryantbiggs bryantbiggs Feb 22, 2021

Choose a reason for hiding this comment

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

so this does could work but theres one slight issue - if you try to test this using the examples/complete-vpc you won't see your changes (all endpoints will still be named complete). we have a deeply nested overloading of tags going on currently (Name set here -> var.tags -> var.vpc_endpoint_tags). I think to fix and decouple this change a little better, lets do this:

  tags = var.vpce_name_include_service ? merge(
    local.vpce_tags,
    {
      "Name" = format("%s-%s", var.name, data.aws_vpc_endpoint_service.codedeploy[0].service)
    },
  ) : local.vpce_tags

And we'll need to add the variable block for the vpce_name_include_service variable where the default is false. This means that today if users don't want to change their VPC endpoint names (aka - leave them as they have been up till now), then this change is transparent to them. however, if users want to opt into this change and have the endpoint service name appended to the VPC endpoint name, they can flip the switch by setting vpce_name_include_service = true

Copy link
Author

Choose a reason for hiding this comment

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

Yep, good idea. I'll get a new PR put up for this. Thanks

Choose a reason for hiding this comment

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

@cjtiffin addressed that here https://github.com/cjtiffin/terraform-aws-vpc/pull/2 - can you please merge ?

Copy link

@chrismazanec chrismazanec left a comment

Choose a reason for hiding this comment

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

hi @bryantbiggs @cjtiffin, shall I make a new direct PR for this or what do you suggest?

comments have been addressed in my branch and PR to @cjtiffin's, https://github.com/cjtiffin/terraform-aws-vpc/pull/2

{
"Name" = format("%s-%s", var.name, data.aws_vpc_endpoint_service.s3[0].service)
},
local.vpce_tags

Choose a reason for hiding this comment

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

@cjtiffin addressed that here https://github.com/cjtiffin/terraform-aws-vpc/pull/2 - can you please merge ?

@github-actions
Copy link

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants