github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/aws/r/api_gateway_integration_response.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_api_gateway_integration_response"
     4  sidebar_current: "docs-aws-resource-api-gateway-integration-response"
     5  description: |-
     6    Provides an HTTP Method Integration Response for an API Gateway Resource.
     7  ---
     8  
     9  # aws\_api\_gateway\_integration\_response
    10  
    11  Provides an HTTP Method Integration Response for an API Gateway Resource.
    12  
    13  -> **Note:** Depends on having `aws_api_gateway_integration` inside your rest api. To ensure this
    14  you might need to add an explicit `depends_on` for clean runs.
    15  
    16  ## Example Usage
    17  
    18  ```hcl
    19  resource "aws_api_gateway_rest_api" "MyDemoAPI" {
    20    name        = "MyDemoAPI"
    21    description = "This is my API for demonstration purposes"
    22  }
    23  
    24  resource "aws_api_gateway_resource" "MyDemoResource" {
    25    rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    26    parent_id   = "${aws_api_gateway_rest_api.MyDemoAPI.root_resource_id}"
    27    path_part   = "mydemoresource"
    28  }
    29  
    30  resource "aws_api_gateway_method" "MyDemoMethod" {
    31    rest_api_id   = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    32    resource_id   = "${aws_api_gateway_resource.MyDemoResource.id}"
    33    http_method   = "GET"
    34    authorization = "NONE"
    35  }
    36  
    37  resource "aws_api_gateway_integration" "MyDemoIntegration" {
    38    rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    39    resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
    40    http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
    41    type        = "MOCK"
    42  }
    43  
    44  resource "aws_api_gateway_method_response" "200" {
    45    rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    46    resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
    47    http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
    48    status_code = "200"
    49  }
    50  
    51  resource "aws_api_gateway_integration_response" "MyDemoIntegrationResponse" {
    52    rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
    53    resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
    54    http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
    55    status_code = "${aws_api_gateway_method_response.200.status_code}"
    56  
    57    # Transforms the backend JSON response to XML
    58    response_templates {
    59      "application/xml" = <<EOF
    60  #set($inputRoot = $input.path('$'))
    61  <?xml version="1.0" encoding="UTF-8"?>
    62  <message>
    63      $inputRoot.body
    64  </message>
    65  EOF
    66    }
    67  }
    68  ```
    69  
    70  ## Argument Reference
    71  
    72  The following arguments are supported:
    73  
    74  * `rest_api_id` - (Required) The ID of the associated REST API
    75  * `resource_id` - (Required) The API resource ID
    76  * `http_method` - (Required) The HTTP method (`GET`, `POST`, `PUT`, `DELETE`, `HEAD`, `OPTION`, `ANY`)
    77  * `status_code` - (Required) The HTTP status code
    78  * `selection_pattern` - (Optional) Specifies the regular expression pattern used to choose
    79    an integration response based on the response from the backend.
    80    If the backend is an `AWS` Lambda function, the AWS Lambda function error header is matched.
    81    For all other `HTTP` and `AWS` backends, the HTTP status code is matched.
    82  * `response_templates` - (Optional) A map specifying the templates used to transform the integration response body
    83  * `response_parameters` - (Optional) A map of response parameters that can be read from the backend response.
    84    For example: `response_parameters = { "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }`,
    85  * `response_parameters_in_json` - **Deprecated**, use `response_parameters` instead.
    86  * `content_handling` - (Optional) Specifies how to handle request payload content type conversions. Supported values are `CONVERT_TO_BINARY` and `CONVERT_TO_TEXT`. If this property is not defined, the response payload will be passed through from the integration response to the method response without modification.