Resource: aws_api_gateway_gateway_response

Provides an API Gateway Gateway Response for a REST API Gateway.

Example Usage

resource "aws_api_gateway_rest_api" "main" {
  name = "MyDemoAPI"
}

resource "aws_api_gateway_gateway_response" "test" {
  rest_api_id   = aws_api_gateway_rest_api.main.id
  status_code   = "401"
  response_type = "UNAUTHORIZED"

  response_templates = {
    "application/json" = "{\"message\":$context.error.messageString}"
  }

  response_parameters = {
    "gatewayresponse.header.Authorization" = "'Basic'"
  }
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports no additional attributes.

Import

In Terraform v1.5.0 and later, use an import block to import aws_api_gateway_gateway_response using REST-API-ID/RESPONSE-TYPE. For example:

import {
  to = aws_api_gateway_gateway_response.example
  id = "12345abcde/UNAUTHORIZED"
}

Using terraform import, import aws_api_gateway_gateway_response using REST-API-ID/RESPONSE-TYPE. For example:

% terraform import aws_api_gateway_gateway_response.example 12345abcde/UNAUTHORIZED