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

Unable to leverage swagger body and create endpoints. #3998

Closed
ctippur opened this issue Mar 30, 2018 · 2 comments
Closed

Unable to leverage swagger body and create endpoints. #3998

ctippur opened this issue Mar 30, 2018 · 2 comments

Comments

@ctippur
Copy link

ctippur commented Mar 30, 2018

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.

Terraform Version

Terraform v0.11.4

Affected Resource(s)

aws_api_gateway_resource
aws_api_gateway_rest_api
template_file

Terraform Configuration Files

data "template_file" "swagger_api" {
  template = "${file("${path.module}/swagger.yaml")}"
}


resource "aws_api_gateway_rest_api" "reset_restapi" {
  name        = "reset_restapi"
  description = "Rest api based on swagger doc"
  body = "${data.template_file.swagger_api.rendered}"

}

resource "aws_api_gateway_resource" "pwreset_resource" {
  rest_api_id = "${aws_api_gateway_rest_api.pwreset_restapi.id}"
  parent_id   = "${aws_api_gateway_rest_api.pwreset_restapi.root_resource_id}"
  path_part   = "rh"
}

resource "aws_api_gateway_method" "method" {
  rest_api_id   = "${aws_api_gateway_rest_api.pwreset_restapi.id}"
  resource_id   = "${aws_api_gateway_resource.pwreset_resource.id}"
  http_method   = "PUT"
  authorization = "NONE"
}

Debug Output

Error: Error applying plan:

1 error(s) occurred:

* module.pw_apigw.aws_api_gateway_resource.reset_resource: 1 error(s) occurred:

* aws_api_gateway_resource.reset_resource: Error creating API Gateway Resource: ConflictException: Another resource with the same parent already has this name: rh
        status code: 409, request id: ee891e22-3458-11e8-a7df-ed925e0c2e87

Panic Output

N/A

Expected Behavior

I would have expected to see the /rh endpoint to be created as declared in swagger.
A follow up question would be that if we have to associate the same lambda function to all the endpoints, do I need to create seperate aws_api_gateway_method and aws_api_gateway_integration for each of the endpoints?

Actual Behavior

Got the error mentioned above.
ConflictException: Another resource with the same parent already has this name: rh

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply

Important Factoids

Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

@ctippur
Copy link
Author

ctippur commented Mar 30, 2018

My bad.. it is indeed creating 2 resources .. one with swagger and the other with aws_api_gateway_rest_api

@ctippur ctippur closed this as completed Mar 30, 2018
@ghost
Copy link

ghost commented Apr 7, 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 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant