Skip to content

Resource: awsApiGatewayModel

Provides a Model 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 awsApiGatewayRestApiMyDemoApi =
  new aws.apiGatewayRestApi.ApiGatewayRestApi(this, "MyDemoAPI", {
    description: "This is my API for demonstration purposes",
    name: "MyDemoAPI",
  });
new aws.apiGatewayModel.ApiGatewayModel(this, "MyDemoModel", {
  contentType: "application/json",
  description: "a JSON schema",
  name: "user",
  restApiId: awsApiGatewayRestApiMyDemoApi.id,
  schema: '${jsonencode({\n    type = "object"\n  })}',
});

Argument Reference

The following arguments are supported:

  • restApiId - (Required) ID of the associated REST API
  • name - (Required) Name of the model
  • description - (Optional) Description of the model
  • contentType - (Required) Content type of the model
  • schema - (Required) Schema of the model in a JSON form

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - ID of the model

Import

awsApiGatewayModel can be imported using restApiId/name, e.g.,

$ terraform import aws_api_gateway_model.example 12345abcde/example