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

aws_vpc_endpoint_service requires additional filter block or name resolution #11168

Closed
ghost opened this issue Dec 6, 2019 · 6 comments · Fixed by #12404
Closed

aws_vpc_endpoint_service requires additional filter block or name resolution #11168

ghost opened this issue Dec 6, 2019 · 6 comments · Fixed by #12404
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@ghost
Copy link

ghost commented Dec 6, 2019

This issue was originally opened by @TrickMcCarthy as hashicorp/terraform#23591. It was migrated here as a result of the provider split. The original body of the issue is below.


SDK version

aws provider 2.40

Use-cases

https://www.terraform.io/docs/providers/aws/d/vpc_endpoint_service.html
This only supports service_name and service. It is missing support for the Name attribute.
The service_name and service are auto-generated each time the service endpoints are created.
The only way to utilize the data source is to hardcode the generated service_name or service id.
In the case I am experiencing the service endpoint is generated by a different service with different terraform state file.

Without supporting retrieval using an end user specified name, this hardcoded value needs to be manually updated each time the service endpoint is recreated. This creates a tight coupling between the services and requires coordination whenever the service endpoint is recreated. It would be much better to reduce this tight coupling.

Attempted Solutions

While the remote_state can be used as a workaround, but it leaves things with tight coupling and this coupling is not suitable when you are trying to upgrade terraform between versions where the state file formats change.
https://www.terraform.io/docs/providers/terraform/d/remote_state.html

Proposal

Add filter block support or retrieval based on the Name attribute, or both.

References

I could not find any, but the original data source was added by this PR
#8396

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 6, 2019
@ewbankkit
Copy link
Contributor

@TrickMcCarthy Could you please provide an example?
Thanks.

@TrickMcCarthy
Copy link

There is no option under the terraform resources to create a vpc_endpoint_service with a Name field (that you can see in the console) and there is no option to read the data source for vpc_endpoint_service using Name field as the retrieval index. This means that the service that is using the vpc_endpoint_service needs to know the service_name field of the vpc_endpoint_service. This service_name attribute of vpc_endpoint_service gets generated each time the vpc_endpoint_service is recreated. The user of the endpoint needs to utilise the hardcoded service_name to retrieve the endpoint_service information, rather than some agreed Name attribute that doesn't change. If you could use the Name attribute, then when the vpc_endpoint_service is recreated, the consumer would not need to update the data entry as they could use the Name attribute(which is not generated on create).
https://www.terraform.io/docs/providers/aws/r/vpc_endpoint_service.html
https://www.terraform.io/docs/providers/aws/d/vpc_endpoint_service.html

So the actions would be allow the creation the the vpc_endpoint_service to add the value for Name Attribute and the data source for vpc_endpoint_service to specify this Name attribute to retrieve the endpoint service_name.

@ewbankkit
Copy link
Contributor

@TrickMcCarthy In common with many other EC2/VPC resources the Name column in the AWS Console corresponds to a resource tag with the Name key.
For example this Terraform code

resource "aws_vpc_endpoint_service" "test" {
  tags = {
    Name = "test-11168"
  }
}

looks like this in the console

Screen Shot 2020-02-10 at 9 37 46 AM

The corresponding data source story is where we currently have a gap.
The underlying AWS DescribeVpcEndpointServices API used by the provider to discover VPC endpoint services supports filtering by tags since AWS SDK v1.19.31, but this functionality has not been implemented in the provider.It should be straightforward to implement this.

Related:

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/ec2 Issues and PRs that pertain to the ec2 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Mar 26, 2020
@bflad bflad added this to the v2.55.0 milestone Mar 26, 2020
@bflad
Copy link
Contributor

bflad commented Mar 26, 2020

Support for this functionality has been merged and will release with version 2.55.0 of the Terraform AWS Provider, likely later today. Thanks to @ewbankkit for the investigative work above and @DrFaust92 for the implementation. 👍

@ghost
Copy link
Author

ghost commented Mar 27, 2020

This has been released in version 2.55.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 for triage. Thanks!

@ghost
Copy link
Author

ghost commented Apr 25, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 25, 2020
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/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants