Provides a Model for a REST API Gateway.
resource "aws_api_gateway_rest_api" "MyDemoAPI" {
name = "MyDemoAPI"
description = "This is my API for demonstration purposes"
}
resource "aws_api_gateway_model" "MyDemoModel" {
rest_api_id = aws_api_gateway_rest_api.MyDemoAPI.id
name = "user"
description = "a JSON schema"
content_type = "application/json"
schema = jsonencode({
type = "object"
})
}
This resource supports the following arguments:
rest_api_id
- (Required) ID of the associated REST APIname
- (Required) Name of the modeldescription
- (Optional) Description of the modelcontent_type
- (Required) Content type of the modelschema
- (Required) Schema of the model in a JSON formThis resource exports the following attributes in addition to the arguments above:
id
- ID of the modelIn Terraform v1.5.0 and later, use an import
block to import aws_api_gateway_model
using REST-API-ID/NAME
. For example:
import {
to = aws_api_gateway_model.example
id = "12345abcde/example"
}
Using terraform import
, import aws_api_gateway_model
using REST-API-ID/NAME
. For example:
% terraform import aws_api_gateway_model.example 12345abcde/example