AWS API Gateway Resource Path

4,287 views
Skip to first unread message

gerardo...@renlearn.com

unread,
Jan 5, 2017, 11:14:19 PM1/5/17
to Terraform
Hello,

Trying to create a chid resource under /my_site, so looking to create /my_site/{id}. I am getting the error below when using the below TF script. Any ideas of what I am missing in the below code?

resource "aws_api_gateway_rest_api" "my_api" {
  name = "my_test_api"
  description = "My Api for testing"
}


resource "aws_api_gateway_resource" "api_resource" {
  parent_id = "${aws_api_gateway_rest_api.my_api.root_resource_id}"
  path_part = "my_site"
}


resource "aws_api_gateway_resource" "api_id_resource" {
  parent_id = "${aws_api_gateway_rest_api.my_api.root_resource_id}"
  path_part = "my_site/{id}"
}

aws_api_gateway_resource.api_id_resource: BadRequestException: Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end.

Thanks..

Walter Dolce

unread,
Jan 6, 2017, 4:22:29 AM1/6/17
to terrafo...@googlegroups.com
At first sight it seems the forward slash is the issue. 


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/d45e7d0b-f381-4660-b5dd-4dddc901ca78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

gerardo...@renlearn.com

unread,
Jan 6, 2017, 8:29:51 AM1/6/17
to Terraform
Tried to change it to the below and same issue persist.

resource "aws_api_gateway_resource" "acs_id_resource" {
  parent_id = "${aws_api_gateway_rest_api.my_api.root_resource_id}"
  path_part = "my_site{id}"
}

On Friday, January 6, 2017 at 4:22:29 AM UTC-5, Walter Dolce wrote:
At first sight it seems the forward slash is the issue. 

On 6 Jan 2017 4:14 am, <gerardo...@renlearn.com> wrote:
Hello,

Trying to create a chid resource under /my_site, so looking to create /my_site/{id}. I am getting the error below when using the below TF script. Any ideas of what I am missing in the below code?

resource "aws_api_gateway_rest_api" "my_api" {
  name = "my_test_api"
  description = "My Api for testing"
}


resource "aws_api_gateway_resource" "api_resource" {
  parent_id = "${aws_api_gateway_rest_api.my_api.root_resource_id}"
  path_part = "my_site"
}


resource "aws_api_gateway_resource" "api_id_resource" {
  parent_id = "${aws_api_gateway_rest_api.my_api.root_resource_id}"
  path_part = "my_site/{id}"
}

aws_api_gateway_resource.api_id_resource: BadRequestException: Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end.

Thanks..

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.

Walter Dolce

unread,
Jan 6, 2017, 8:47:22 AM1/6/17
to terrafo...@googlegroups.com
I think the name still doesn't comply with the expected format:

"Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end."


To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/84239518-1884-407e-90db-1e287fe3e088%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

walter dolce | senior full stack software engineer 
Zend Certified Engineer PHP5 // Magento Certified Developer Plus

twitter 
@walterdolce
skype walter.dolce
tel +44 (or 0) 7873 527127

gerardo...@renlearn.com

unread,
Jan 6, 2017, 11:20:59 AM1/6/17
to Terraform
So is there no way to support that format?.. Even though a child resource can be created via the AWS Console using the format below.

gerardo...@renlearn.com

unread,
Jan 8, 2017, 8:24:07 AM1/8/17
to Terraform
I was able to figure this out I had to update the TF as the below.

resource "aws_api_gateway_rest_api" "my_api" {
  name = "my_test_api"
  description = "My Api for testing"
}


resource "aws_api_gateway_resource" "api_resource" {
  parent_id = "${aws_api_gateway_rest_api.my_api.root_resource_id}"
  path_part = "my_site"
}


resource "aws_api_gateway_resource" "api_id_resource" {
  path_part = "{id}"
}
Reply all
Reply to author
Forward
0 new messages