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

[Enhancement]: User Defined IP on VPC endpoints #34147

Closed
ckotil opened this issue Oct 27, 2023 · 8 comments · Fixed by #37226
Closed

[Enhancement]: User Defined IP on VPC endpoints #34147

ckotil opened this issue Oct 27, 2023 · 8 comments · Fixed by #37226
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/vpc Issues and PRs that pertain to the vpc service.
Milestone

Comments

@ckotil
Copy link

ckotil commented Oct 27, 2023

Description

AWS recently added support for VPC Endpoints allowing to pick your own IP:
https://aws.amazon.com/about-aws/whats-new/2023/08/aws-privatelink-user-defined-ip-vpc-endpoints/

The Console UI now supports this as well (step 8):
https://docs.aws.amazon.com/vpc/latest/privatelink/create-interface-endpoint.html#create-interface-endpoint-aws

It looks like this new capability has not yet made its way to the AWS Provider yet.

One approach could be to allow the aws_vpc_endpoint resource to specify the network_interface_ids. Requiring the Network Interfaces to be provisioned before the VPC Endpoint, and allowing users to choose an IP.

╷
│ Error: Value for unconfigurable attribute
│
│   with aws_vpc_endpoint.this,
│   on main.tf line 3, in resource "aws_vpc_endpoint" "this":
│    3:     network_interface_ids = [
│    4:         aws_network_interface.test1.id,
│    5:         aws_network_interface.test2.id,
│    6:     ]
│
│ Can't configure a value for "network_interface_ids": its value will be decided automatically based on the result of applying this
│ configuration.

Thanks,
--Chad

Affected Resource(s) and/or Data Source(s)

aws_vpc_endpoint

Potential Terraform Configuration

resource "aws_vpc_endpoint" "this" {
    ip_address_type       = "ipv4"
//    network_interface_ids = [
//        aws_network_interface.test1.id
//        aws_network_interface.test2.id
//    ]
    policy                = jsonencode(
        {
            Statement = [
                {
                    Action    = "*"
                    Effect    = "Allow"
                    Principal = "*"
                    Resource  = "*"
                },
            ]
        }
    )
    private_dns_enabled   = true
    route_table_ids       = []
    security_group_ids    = [
        "sg-0707d83e8bad17a68",
    ]
    service_name          = "aws.sagemaker.us-west-2.studio"
    subnet_ids            = [
        "subnet-06fb9377a141332d4",
        "subnet-0b92395c83428cea0",
    ]
    tags                  = {"Name" = "ckotil-test-tf"}
    tags_all              = {}
    vpc_endpoint_type     = "Interface"
    vpc_id                = "vpc-0c5247b14f09aea8a"

    dns_options {
        dns_record_ip_type                             = "ipv4"
        private_dns_only_for_inbound_resolver_endpoint = false
    }

    timeouts {}
}

resource "aws_network_interface" "test1" {
  subnet_id       = "subnet-06fb9377a141332d4"
  private_ips     = ["10.168.184.81"]
  security_groups = ["sg-0707d83e8bad17a68"]
  tags                  = {"Name" = "ckotil-test-tf-1"}
}

resource "aws_network_interface" "test2" {
  subnet_id       = "subnet-0b92395c83428cea0"
  private_ips     = ["10.168.184.243"]
  security_groups = ["sg-0707d83e8bad17a68"]
    tags                  = {"Name" = "ckotil-test-tf-2"}
}

References

No response

Would you like to implement a fix?

No

@ckotil ckotil added the enhancement Requests to existing resources that expand the functionality or scope. label Oct 27, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/vpc Issues and PRs that pertain to the vpc service. label Oct 27, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 27, 2023
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Nov 7, 2023
@noneymous
Copy link

What's the current status on this?

@ckotil
Copy link
Author

ckotil commented Mar 25, 2024

What's the current status on this?

No movement yet. I think the issue needs more upvotes.

@noneymous
Copy link

noneymous commented Apr 4, 2024

Alright, I upvoted it too, there are some upvotes already :)

I'm not quite sure why this is not implemented or not more popular. The aws_vpc_endpoint resource is not practical currently. It leads to race conditions for the same private IPs, competing with other instances (with fixed IPs) defined in the remaining terraform script. Introducing another subnet for the endpoints just to compensate for the unpredictability is a bit of an overhead.

Furthermore, having an endpoint that has a different IP each time it is (re-)created, is a bit contrary to its purpose. Obviously, other instances have a more or less static configuration trying to connect to it.

Furthermore, it's also not easy to read the finally applied private IP with terraform, in order to update other resources.

@ddericco
Copy link
Contributor

This is being worked on.

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.54.0 milestone Jun 13, 2024
Copy link

This functionality has been released in v5.54.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue 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 similar to this, 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 Jul 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/vpc Issues and PRs that pertain to the vpc service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants