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

Feature Request: Data source to get API Gateway REST API by name #4146

Closed
timborrowdale opened this issue Apr 10, 2018 · 3 comments
Closed
Labels
enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues.
Milestone

Comments

@timborrowdale
Copy link
Contributor

Use case:

We would like to be able to independently deploy resource integrations to a single API Gateway. e.g.

  1. Main pipeline creates API Gateway
  2. Resource 1 pipeline creates lambda function and sets up integration on API Gateway for resource /1
  3. Resource 2 pipeline creates lambda function and sets up integration on API Gateway for resource /2

In order to do this the following terraform resources need knowledge of the existing API Gateway:

Suggested data source

data "aws_api_gateway_rest_api" "by_name" {
  name = "my-gateway"
}

which would return id and root_resource_id as computed attributes

I can have a go at implementing this if it is considered useful, but I have a concern that currently it is possible to create two API Gateways with the same name. What would be the expected output of a query where there is more than one match?

@catsby
Copy link
Contributor

catsby commented Apr 10, 2018

Seems possible, unfortunately there is no "filter" for the GetRestAPIs endpoint. You send the query and get a paginated result, we'd have to loop through and pattern match on the name 😦

Still, a reasonable request. I don't believe anyone on the Terraform team will be able to get to this, but if someone is reading this and wants to give it a try, I would recommend copying the AutoScaling Group Data Source and test file, and modifying to do as I mentioned:

  • grab name from config
  • call GetRestApis
  • loop until we find a match

The SDK includes GetRestApisPages which will handle the paginated requests:

@catsby catsby added enhancement Requests to existing resources that expand the functionality or scope. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues. labels Apr 10, 2018
@bflad
Copy link
Contributor

bflad commented Apr 18, 2018

The aws_api_gateway_rest_api data source has been released in version 1.15.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@bflad bflad added this to the v1.15.0 milestone Apr 18, 2018
@bflad bflad closed this as completed Apr 18, 2018
@ghost
Copy link

ghost commented Apr 6, 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 6, 2020
This issue was closed.
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. good first issue Call to action for new contributors looking for a place to start. Smaller or straightforward issues.
Projects
None yet
Development

No branches or pull requests

3 participants