# Variables ==================================================================== variable "name_prefix" { description = "Prefix prepended to resource names created by this module" type = string validation { condition = length(trimspace(var.name_prefix)) > 0 error_message = "name_prefix must not be empty." } } variable "aws_region" { description = "AWS region to build service_name endpoints against (e.g. com.amazonaws..)" type = string validation { condition = can(regex("^[a-z]{2}-[a-z]+-[0-9]$", var.aws_region)) error_message = "aws_region must be a valid AWS region format e.g. us-west-2." } } variable "vpc_id" { description = "VPC ID in which to create endpoints" type = string } variable "vpc_cidr_block" { description = "Primary VPC CIDR block, used to scope the interface endpoint security group's ingress rule" type = string validation { condition = can(cidrhost(var.vpc_cidr_block, 0)) error_message = "vpc_cidr_block must be valid IPv4 CIDR notation." } } variable "subnet_ids" { description = "Subnet IDs to place Interface endpoint ENIs in. Required when any endpoint in var.endpoints has type = \"Interface\"." type = list(string) default = [] } variable "route_table_ids" { description = "Route table IDs to associate with Gateway endpoints. Required when any endpoint in var.endpoints has type = \"Gateway\"." type = list(string) default = [] } variable "endpoints" { description = <<-EOT Map of endpoint definitions to create. No default — the caller decides which services are needed. service_name is the short AWS service name (e.g. "s3", "kms"). type must be "Gateway" or "Interface". EOT type = map(object({ service_name = string type = string private_dns_enabled = optional(bool, true) policy = optional(string, null) })) validation { condition = alltrue([ for k, v in var.endpoints : contains(["Gateway", "Interface"], v.type) ]) error_message = "Each endpoint's type must be either \"Gateway\" or \"Interface\"." } validation { condition = alltrue([ for k, v in var.endpoints : length(trimspace(v.service_name)) > 0 ]) error_message = "Each endpoint's service_name must not be empty." } } variable "tags" { description = "Resource tags to apply to all resources" type = map(string) default = {} }