variable "name" { description = "Name for the API" type = string } variable "protocol_type" { description = "API type — HTTP or WEBSOCKET" type = string default = "HTTP" validation { condition = contains(["HTTP", "WEBSOCKET"], var.protocol_type) error_message = "protocol_type must be HTTP or WEBSOCKET." } } variable "description" { description = "API description" type = string default = "" } variable "cors_configuration" { description = "CORS configuration for HTTP APIs" type = object({ allow_origins = optional(list(string), ["*"]) allow_methods = optional(list(string), ["GET", "POST", "PUT", "DELETE", "OPTIONS"]) allow_headers = optional(list(string), ["Content-Type", "Authorization"]) expose_headers = optional(list(string), []) max_age = optional(number, 86400) allow_credentials = optional(bool, false) }) default = null } variable "stages" { description = "Map of API stages to deploy" type = map(object({ name = string auto_deploy = optional(bool, true) throttle_burst_limit = optional(number, 5000) throttle_rate_limit = optional(number, 10000) access_log_arn = optional(string, null) access_log_format = optional(string, "$context.requestId $context.identity.sourceIp $context.httpMethod $context.routeKey $context.status $context.responseLength $context.requestTime") default_route_settings = optional(object({ throttling_burst_limit = optional(number, 5000) throttling_rate_limit = optional(number, 10000) }), null) })) default = { default = { name = "$default" } } } variable "integrations" { description = "Map of API integrations" type = map(object({ integration_type = string # AWS_PROXY, HTTP_PROXY, MOCK integration_uri = optional(string, null) integration_method = optional(string, "POST") payload_format_version = optional(string, "2.0") timeout_milliseconds = optional(number, 29000) })) default = {} } variable "routes" { description = "Map of API routes" type = map(object({ route_key = string integration_key = optional(string, null) authorization_type = optional(string, "NONE") authorizer_id = optional(string, null) })) default = {} } variable "custom_domain" { description = "Custom domain name configuration" type = object({ domain_name = string acm_certificate_arn = string endpoint_type = optional(string, "REGIONAL") stage_key = optional(string, "default") api_mapping_key = optional(string, null) }) default = null } variable "tags" { description = "Resource tags to apply to all resources" type = map(string) default = {} }