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 integration with Swagger does not seem to consider basePath #4402

Closed
arichiardi opened this issue May 1, 2018 · 7 comments · Fixed by #7374
Closed

AWS integration with Swagger does not seem to consider basePath #4402

arichiardi opened this issue May 1, 2018 · 7 comments · Fixed by #7374
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/apigateway Issues and PRs that pertain to the apigateway service. upstream Addresses functionality related to the cloud provider.
Milestone

Comments

@arichiardi
Copy link

Terraform Version

Terraform v0.11.7

Affected Resource(s)

  • aws_api_gateway_rest_api

Terraform Configuration Files

resource "aws_api_gateway_rest_api" "rest_api" {
  name        = "${local.full_prefix}-ep-cloud-api"
  description = "${local.api_title}"
  body        = "${data.template_file.swagger_template.rendered}"
}
...swagger...
 "basePath": "prod",
 "schemes": [
    "https"
  ],
...

Expected Behavior

In the AWS Api Gateway I see:

Auth: NONE
ARN: arn:aws:execute-api:region:accountId:apiId/*/POST/my-endpoint

But I think I should see:

ARN: arn:aws:execute-api:region:accountId:apiId/*/POST/prod/my-endpoint

where the prod is read from the Swagger's basePath, according to https://swagger.io/docs/specification/2-0/api-host-and-base-path.

Actual Behavior

What actually happened?

Steps to Reproduce

Try a swagger.json with basePath set.

Important Factoids

There are workarounds I think, still worth signaling.

@bflad bflad added question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. upstream Addresses functionality related to the cloud provider. service/apigateway Issues and PRs that pertain to the apigateway service. labels May 1, 2018
@bflad
Copy link
Contributor

bflad commented May 1, 2018

Hi @arichiardi 👋 Sorry you're running into trouble here. Does Swagger's basePath work with the AWS CLI? If not, you might want to open an AWS support case.

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label May 1, 2018
@arichiardi
Copy link
Author

Oh so are you just sending the json to them? I thought terraform was doing the parsing.

@bflad
Copy link
Contributor

bflad commented May 12, 2018

Correct, we just upload the JSON to the API:

https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_api_gateway_rest_api.go#L113-L123

Given this looks like broken functionality of the API Gateway API, I'm going to close this issue for now but do not hesitate to reply back if there's something amiss with the provider handling here.

@bflad bflad closed this as completed May 12, 2018
@arichiardi
Copy link
Author

Perfect thank you

@mattetherton
Copy link

I also encountered this issue and was able to find a work around by adding the basePath to each individual path.

e,g
"paths": { "/v1/example": {

However, according to the AWS CLI it is possible for the basePath to actually have an effect by using a parameter.

aws apigateway import-rest-api --parameters basepath=prepend --body

For details: https://forums.aws.amazon.com/thread.jspa?messageID=885830&tstart=0

@bflad would you mind reviewing?

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label May 2, 2019
@ghost
Copy link

ghost commented Mar 30, 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 30, 2020
@github-actions github-actions bot added this to the v3.24.0 milestone Jan 12, 2021
@ghost
Copy link

ghost commented Jan 15, 2021

This has been released in version 3.24.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 ghost unlocked this conversation Jan 15, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jan 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question A question about existing functionality; most questions are re-routed to discuss.hashicorp.com. service/apigateway Issues and PRs that pertain to the apigateway service. upstream Addresses functionality related to the cloud provider.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants