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

API Gateway private REST API - Support VPC Endpoint #10627

Merged
merged 4 commits into from
Jan 18, 2020

Conversation

DrFaust92
Copy link
Collaborator

@DrFaust92 DrFaust92 commented Oct 25, 2019

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Closes #10154

Release note for CHANGELOG:

resource/aws_api_gateway_rest_api: Add vpc_endpoint_ids argument

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAWSAPIGatewayRestApi_'

--- PASS: TestAccAWSAPIGatewayRestApi_basic (138.81s)
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration (121.38s)
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration_Private (151.55s)
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VPCEndpoint (506.39s)
--- PASS: TestAccAWSAPIGatewayRestApi_api_key_source (431.64s)
--- PASS: TestAccAWSAPIGatewayRestApi_policy (107.07s)
--- PASS: TestAccAWSAPIGatewayRestApi_openapi (75.58s)
...

@DrFaust92 DrFaust92 requested a review from a team October 25, 2019 08:30
@ghost ghost added size/M Managed by automation to categorize the size of a PR. service/apigateway Issues and PRs that pertain to the apigateway service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Oct 25, 2019
@ghost ghost added size/L Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. and removed size/M Managed by automation to categorize the size of a PR. labels Oct 25, 2019
@DrFaust92 DrFaust92 changed the title [WIP] API Gateway private REST API - Support VPC Endpoint API Gateway private REST API - Support VPC Endpoint Oct 25, 2019
aws/resource_aws_api_gateway_rest_api.go Outdated Show resolved Hide resolved
aws/resource_aws_api_gateway_rest_api.go Outdated Show resolved Hide resolved
@DrFaust92
Copy link
Collaborator Author

fixed according to @folbricht comments:

$ make testacc TESTARGS='-run=TestAccAWSAPIGatewayRestApi_'

=== RUN   TestAccAWSAPIGatewayRestApi_basic
=== PAUSE TestAccAWSAPIGatewayRestApi_basic
=== CONT  TestAccAWSAPIGatewayRestApi_basic
--- PASS: TestAccAWSAPIGatewayRestApi_basic (118.65s)
=== RUN   TestAccAWSAPIGatewayRestApi_EndpointConfiguration
=== PAUSE TestAccAWSAPIGatewayRestApi_EndpointConfiguration
=== CONT  TestAccAWSAPIGatewayRestApi_EndpointConfiguration
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration (127.70s)
=== RUN   TestAccAWSAPIGatewayRestApi_EndpointConfiguration_Private
=== PAUSE TestAccAWSAPIGatewayRestApi_EndpointConfiguration_Private
=== CONT  TestAccAWSAPIGatewayRestApi_EndpointConfiguration_Private
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration_Private (121.22s)
=== RUN   TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VPCEndpoint
=== PAUSE TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VPCEndpoint
=== CONT  TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VPCEndpoint
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VPCEndpoint (574.07s)
=== RUN   TestAccAWSAPIGatewayRestApi_api_key_source
=== PAUSE TestAccAWSAPIGatewayRestApi_api_key_source
=== CONT  TestAccAWSAPIGatewayRestApi_api_key_source
--- PASS: TestAccAWSAPIGatewayRestApi_api_key_source (335.67s)
=== RUN   TestAccAWSAPIGatewayRestApi_policy
=== PAUSE TestAccAWSAPIGatewayRestApi_policy
=== CONT  TestAccAWSAPIGatewayRestApi_policy
--- PASS: TestAccAWSAPIGatewayRestApi_policy (149.33s)
=== RUN   TestAccAWSAPIGatewayRestApi_openapi
=== PAUSE TestAccAWSAPIGatewayRestApi_openapi
=== CONT  TestAccAWSAPIGatewayRestApi_openapi
--- PASS: TestAccAWSAPIGatewayRestApi_openapi (88.30s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	670.232s

@davidmco65
Copy link

Any idea when this will be merged? I've literally got this exact problem holding my deployment up right now. Thanks!

@cleverton-heusner
Copy link

Hi, guys.

Any news about this merge request? We really need it in our project. Thanks a lot!

@DrFaust92
Copy link
Collaborator Author

DrFaust92 commented Nov 20, 2019

@bflad, can you help out with this?

For some reason I can't restore the review request on the PR

@dininski
Copy link

Any news on merging this PR? We would also benefit massively from this feature in our project.

Thanks in advance and all the best!

@UsmanMohammad
Copy link

Hi,

We are also looking for this feature as well.

Many thanks

@gncj
Copy link

gncj commented Dec 6, 2019

Hello,

any update on this request?

@tokiwong
Copy link
Contributor

tokiwong commented Dec 6, 2019

Hello,

I am also looking for this feature

@skyguy94
Copy link

I'm looking for this feature as well.

@cleblanc87
Copy link

Any feedback from the core team on this PR?

@gracebrownecodes
Copy link

In case it's useful to anyone here, this is my workaround for the moment, a null resource provisioner to run the aws cli command that associates a vpc endpoint with the api gateway. This obviously assumes you have a the referenced resources elsewhere in your config.

# Associate the API Gateway with the VPC endpoint so that we can access it without using a custom header,
#   which is not possible in browser pre-flight CORS requests.
# See: https://forums.aws.amazon.com/thread.jspa?messageID=916693
# And: https://docs.aws.amazon.com/apigateway/latest/developerguide/associate-private-api-with-vpc-endpoint.html
# Terraform PR to add this ability here: https://github.com/terraform-providers/terraform-provider-aws/pull/10627
resource null_resource api_vpc_endpoint {
  provisioner local-exec {
    command = join("", [
      "aws apigateway update-rest-api ",
      "--rest-api-id ${aws_api_gateway_rest_api.default.id} ",
      "--patch-operations \"op='add',path='/endpointConfiguration/vpcEndpointIds',value='${data.aws_vpc_endpoint.api_gateway.id}'\" ",
      "--region ${var.region}",
    ])
  }
}

@DrFaust92
Copy link
Collaborator Author

I'd like to add terraform-providers/aws-provider as a reviewer but am not able to for some reason.
Can anyone from the core team assist? @bflad @aeschright

@aeschright aeschright requested a review from a team January 10, 2020 20:12
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Jan 17, 2020
@bflad bflad added this to the v2.46.0 milestone Jan 18, 2020
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @DrFaust92 🚀

Output from acceptance testing:

--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration_Private (64.02s)
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration (125.87s)
--- PASS: TestAccAWSAPIGatewayRestApi_policy (160.06s)
--- PASS: TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VPCEndpoint (189.90s)
--- PASS: TestAccAWSAPIGatewayRestApi_tags (249.67s)
--- PASS: TestAccAWSAPIGatewayRestApi_basic (271.25s)
--- PASS: TestAccAWSAPIGatewayRestApi_api_key_source (364.21s)
--- PASS: TestAccAWSAPIGatewayRestApi_disappears (401.90s)
--- PASS: TestAccAWSAPIGatewayRestApi_openapi (620.15s)

@bflad bflad merged commit 8ecc645 into hashicorp:master Jan 18, 2020
bflad added a commit that referenced this pull request Jan 18, 2020
@ghost
Copy link

ghost commented Jan 23, 2020

This has been released in version 2.46.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!

@DrFaust92 DrFaust92 deleted the api-gw-private-domain branch January 24, 2020 16:27
@gracebrownecodes
Copy link

Is anyone else experience unreliability with this configuration? I am seeing a successful apply, no errors or failures, but the api gateway is still NOT associated with the VPCE.

@ghost
Copy link

ghost commented Mar 27, 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 Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/apigateway Issues and PRs that pertain to the apigateway service. size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Amazon API Gateway private REST APIs with VPC endpoints