Creates an API Gateway with a REST API, a resource, a GET method, and a MOCK integration that transforms XML requests to JSON.

Terraform Template

resource "aws_api_gateway_integration" "MyDemoIntegration" {
  cache_key_parameters = ["method.request.path.param"]
  cache_namespace = "foobar"
  http_method = aws_api_gateway_method.MyDemoMethod.http_method

  request_parameters = {
    integration.request.header.X-Authorization = "'static'"
    integration = "[object Object]"
  }

  request_templates = {
    application/xml = <<-EOF
undefined  {
undefined   "body" : $input.json('$')
undefined  }
undefined  
undefinedEOF
  }
  resource_id = aws_api_gateway_resource.MyDemoResource.id
  rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
  timeout_milliseconds = 29000
  type = "MOCK"
}

resource "aws_api_gateway_method" "MyDemoMethod" {
  authorization = "NONE"
  http_method = "GET"
  resource_id = aws_api_gateway_resource.MyDemoResource.id
  rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
}

resource "aws_api_gateway_resource" "MyDemoResource" {
  parent_id = aws_api_gateway_rest_api.MyDemoAPI.root_resource_id
  path_part = "mydemoresource"
  rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
}

resource "aws_api_gateway_rest_api" "MyDemoAPI" {
  description = "This is my API for demonstration purposes"
  name = "MyDemoAPI"
}