This template sets up an API Gateway with a MOCK integration and a method response, transforming JSON to XML.

Terraform Template

resource "aws_api_gateway_integration" "MyDemoIntegration" {
  http_method = aws_api_gateway_method.MyDemoMethod.http_method
  resource_id = aws_api_gateway_resource.MyDemoResource.id
  rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
  type = "MOCK"
}

resource "aws_api_gateway_integration_response" "MyDemoIntegrationResponse" {
  http_method = aws_api_gateway_method.MyDemoMethod.http_method
  resource_id = aws_api_gateway_resource.MyDemoResource.id

  response_templates = {
    application/xml = <<-EOF
undefined  #set($inputRoot = $input.path('$'))
undefined  <?xml version="1.0" encoding="UTF-8"?>
undefined  <message>
undefined   $inputRoot.body
undefined  </message>
undefined  
undefinedEOF
  }
  rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
  status_code = aws_api_gateway_method_response.response_200.status_code
}

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_method_response" "response_200" {
  http_method = aws_api_gateway_method.MyDemoMethod.http_method
  resource_id = aws_api_gateway_resource.MyDemoResource.id
  rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
  status_code = "200"
}

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"
}