Specifying a request template for a aws_api_gateway_integration in terraform
<p>In the <a href="https://www.terraform.io/docs/providers/aws/r/api_gateway_integration.html">Terraform documentation for AWS_API_GATEWAY_INTEGRATION</a>, the following parameters are supported:</p>

<ul>
<li>rest_api_id</li>
<li>resource_id</li>
<li>http_method</li>
<li>type</li>
<li>uri</li>
<li>integration_http_method </li>
</ul>

<p>They give this example:</p>

<pre><code>resource "aws_api_gateway_integration" "MyDemoIntegration" {
  rest_api_id = "${aws_api_gateway_rest_api.MyDemoAPI.id}"
  resource_id = "${aws_api_gateway_resource.MyDemoResource.id}"
  http_method = "${aws_api_gateway_method.MyDemoMethod.http_method}"
  type = "MOCK"
}
</code></pre>

<p>But I would like to specify a mapping template (as well as a Lambda integration), as you can with the UI:</p>

<p><a href="https://i.stack.imgur.com/fCAiW.png"><img src="https://i.stack.imgur.com/fCAiW.png" alt="enter image description here"></a></p>

<p>However I see no way of doing that with Terraform. Is is possible ?</p>

<p><strong>Note:</strong> What I am currently doing is <code>apply</code>ing the rest of the configuration (lambda, s3, iam etc...), and then adding mapping template manually afterwards (as well as the integration type of lambda).</p>

<p>But then every time I <code>terraform apply</code> to apply some other config (eg: s3), Terraform reverts back the mapping template and the integration type.</p>

<p>The "reverting" plan looks like this: </p>

<pre><code>~ aws_api_gateway_integration.post_hit_integration
    request_templates.#:                "1" =&gt; "0"
    request_templates.application/json: "{\n  \"body\" : $input.json('$'),\n  \"headers\": {\n    #foreach($param in $input.params().header.keySet())\n    \"$param\": \"$util.escapeJavaScript($input.params().header.get($param))\" #if($foreach.hasNext),#end\n    \n    #end  \n  },\n  \"stage\" : \"$context.stage\"\n}" =&gt; ""
    uri:                                "arn:aws:apigateway:eu-west-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-west-1:000000000000:function:create_hit/invocations" =&gt; ""
</code></pre>