API Gateway and Request Parameters in JSON

412 views
Skip to first unread message

Eric Anderson

unread,
May 13, 2016, 10:07:28 AM5/13/16
to Terraform
Hey,

I'm using terraform to set up an API Gateway for Lambda.  It is working now and automatically passing through parameters, but I would like to have some defined querystring parameters and headers in the method request. This seems to map to the terraform method resource, which I have defined as so.

resource "aws_api_gateway_method" "IntuitCreateGet" {
  http_method = "POST"
  authorization = "NONE"
}

From the docs, it seems like request_parameters_in_json is the appropriate tag.  https://www.terraform.io/docs/providers/aws/r/api_gateway_method.html#request_parameters_in_json

Can anyone help me on how to define this json in a way terraform can understand.  
1.  It looks like terraform wants this as a string, so I was trying

request_parameters_in_json = <<EOF
{
   Object
}
EOF

2.  I'm not sure what the object should be.  I was picturing

{
   "querystring": {
      "param1": true,
      "param2": false
  },
  "headers" : {
      "header1": true
 }
}

where true/false is required/not required, but then again, I don't see a required tag in the console for API gateway method request.

I'm looking for a little clarification on the general structure of "request_parameters_in_json" and if it maps to a particular aws call or something.

Thanks!
Eric

Reply all
Reply to author
Forward
Message has been deleted
0 new messages