-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Import an API into API Gateway from a Swagger #11034
Comments
+1 |
+1 |
+1 |
I stumbled into this while looking for something unrelated, but it looks like #6175 is looking to implement this. (As for the other commenters: you can press the Thumbs Up on the original post to +1, that saves some redundant emails.) |
Hi @n-my Hi @timmytofu Thanks so much for the request! Sorry we took so long to get back to you. While we'd love to see something like this, we don't currently have any plans to implement this ourselves. Until then, this issue is unlikely to see any movement and remain stale. We're trying to prune the stale issues (that aren't going to be addressed anytime soon) by closing them. Note that we only do this for enhancement requests and not bugs. If you are still interested in this feature being part of Terraform, then we would gladly review a Pull Request. Thanks |
I spent a couple weeks trying to get this to work before I found out terraform isn't supporting it. IMO, terraform needs a "doesn't really support API Gateway" on the front page / README. If anyone has found a way to actually use API Gateway from terraform in production (without lots of manual setup), I'd love to pick your brain. Right now, I'm forced to consider alternatives like serverless, Zappa, or CloudFormation. |
@combinatorist , you could use a null resource with an aws cli call to upload swagger json as a workaround - I think that's what I'll try, I just came across this issue too. Also in the worst case, you could use a cloudformation template from within terraform. |
Thanks for the suggestion, @gtmtech. FWIW, I'm not as concerned about Swagger as I am about stateless support for AWS API Gateway (more below). So, in case anyone else is curious, here's my more general solution to a more general problem. And please, if anyone knows better than I do, jump into correct me. API State (and Swagger)I got the impression terraform doesn't actually support AWS API Gateway, but the fundamental issue is that AWS API Gateway is stateful - i.e. it cannot report out its complete, exact current state to terraform, so terraform can't know whether it needs to be modified, rebuilt, or left alone. I suspect this may also be why you have to set some of your own manual terraform dependencies to work with API Gateway. The biggest advantage of Swagger (for me) would be a complete stateless description of the API, but I don't think AWS is doing it's part, so there'd still be no way to know exactly how it connects to the rest of your AWS infrastructure (e.g. your lambda functions). So, you may have to But I really wanted separation of environments, so I don't let AWS API Gateway manage my "stages". My solutionSo, I actually create a separate AWS API per stage (which correspond to my terraform environments). Unfortunately, because AWS API Gateway silently includes its own CloudFront distribution, I ultimately have to have a separate subdomain for each environment / stage of the API like so:
These are all variations of the same (logical) API, but they have different subdomains with different CloudFront distributions, built into separate AWS API Gateways, with separate variations of the same (logical) lambda functions and DynamoDB table. |
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. |
Context
The AWS API let us import an API from a JSON Swagger (v2.0) (see here and here)
It would be nice to support this feature in Terraform. This has been already asked in #3675 but it was not the original request of the issue.
As a note :
The API Gateway extensions to the Swagger specification support the AWS-specific authorization and API Gateway-specific API integrations (see here)
Potential solutions
We could either use directly JSON files or use a data source
aws_api_swagger
to store to swagger.Then we could update the resource
aws_api_gateway_rest_api
to specifiy a swagger.The text was updated successfully, but these errors were encountered: