Skip to content

Resource: awsApiGatewayGatewayResponse

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

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsApiGatewayRestApiMain = new aws.apiGatewayRestApi.ApiGatewayRestApi(
  this,
  "main",
  {
    name: "MyDemoAPI",
  }
);
new aws.apiGatewayGatewayResponse.ApiGatewayGatewayResponse(this, "test", {
  responseParameters: {
    "gatewayresponse.header.Authorization": "'Basic'",
  },
  responseTemplates: {
    "application/json": '{"message":$context.error.messageString}',
  },
  responseType: "UNAUTHORIZED",
  restApiId: awsApiGatewayRestApiMain.id,
  statusCode: "401",
});

Argument Reference

The following arguments are supported:

  • restApiId - (Required) String identifier of the associated REST API.
  • responseType - (Required) Response type of the associated GatewayResponse.
  • statusCode - (Optional) HTTP status code of the Gateway Response.
  • responseTemplates - (Optional) Map of templates used to transform the response body.
  • responseParameters - (Optional) Map of parameters (paths, query strings and headers) of the Gateway Response.

Attributes Reference

No additional attributes are exported.

Import

awsApiGatewayGatewayResponse can be imported using restApiId/responseType, e.g.,

$ terraform import aws_api_gateway_gateway_response.example 12345abcde/UNAUTHORIZED