variables.tf•7.35 kB
################################################################################
# Terraform Variables for KYC MCP Server
################################################################################
variable "aws_region" {
description = "AWS region to deploy resources"
type = string
default = "us-east-1"
}
variable "project_name" {
description = "Project name used for resource naming"
type = string
default = "kyc-mcp-server"
}
variable "environment" {
description = "Environment name (dev, staging, production)"
type = string
default = "production"
validation {
condition = contains(["dev", "staging", "production"], var.environment)
error_message = "Environment must be dev, staging, or production."
}
}
################################################################################
# Network Configuration
################################################################################
variable "create_vpc" {
description = "Whether to create a new VPC"
type = bool
default = true
}
variable "vpc_cidr" {
description = "CIDR block for VPC"
type = string
default = "10.0.0.0/16"
}
variable "availability_zones" {
description = "List of availability zones"
type = list(string)
default = ["us-east-1a", "us-east-1b"]
}
variable "existing_vpc_id" {
description = "ID of existing VPC (if create_vpc is false)"
type = string
default = ""
}
variable "existing_subnet_id" {
description = "ID of existing subnet (if create_vpc is false)"
type = string
default = ""
}
################################################################################
# EC2 Instance Configuration
################################################################################
variable "instance_type" {
description = "EC2 instance type"
type = string
default = "t3.medium"
validation {
condition = can(regex("^t[23]\\.(nano|micro|small|medium|large|xlarge|2xlarge)$", var.instance_type))
error_message = "Instance type must be a valid t2 or t3 instance type."
}
}
variable "ami_id" {
description = "AMI ID to use (leave empty for latest)"
type = string
default = ""
}
variable "os_type" {
description = "Operating system type (amazon-linux or ubuntu)"
type = string
default = "ubuntu"
validation {
condition = contains(["amazon-linux", "ubuntu"], var.os_type)
error_message = "OS type must be amazon-linux or ubuntu."
}
}
variable "root_volume_type" {
description = "Root volume type"
type = string
default = "gp3"
validation {
condition = contains(["gp2", "gp3", "io1", "io2"], var.root_volume_type)
error_message = "Volume type must be gp2, gp3, io1, or io2."
}
}
variable "root_volume_size" {
description = "Root volume size in GB"
type = number
default = 30
validation {
condition = var.root_volume_size >= 20 && var.root_volume_size <= 1000
error_message = "Root volume size must be between 20 and 1000 GB."
}
}
variable "enable_detailed_monitoring" {
description = "Enable detailed CloudWatch monitoring"
type = bool
default = true
}
################################################################################
# Security Configuration
################################################################################
variable "allowed_ssh_cidrs" {
description = "List of CIDR blocks allowed to SSH"
type = list(string)
default = ["0.0.0.0/0"]
}
variable "allowed_monitoring_cidrs" {
description = "List of CIDR blocks allowed to access monitoring endpoints"
type = list(string)
default = ["0.0.0.0/0"]
}
variable "create_key_pair" {
description = "Whether to create a new key pair"
type = bool
default = false
}
variable "ssh_public_key" {
description = "SSH public key content (required if create_key_pair is true)"
type = string
default = ""
}
variable "existing_key_name" {
description = "Name of existing key pair (if create_key_pair is false)"
type = string
default = ""
}
################################################################################
# Networking
################################################################################
variable "use_elastic_ip" {
description = "Whether to use an Elastic IP"
type = bool
default = true
}
################################################################################
# Backup Configuration
################################################################################
variable "enable_s3_backup" {
description = "Enable S3 backups"
type = bool
default = true
}
variable "create_backup_bucket" {
description = "Whether to create a new S3 bucket for backups"
type = bool
default = true
}
variable "backup_bucket_name" {
description = "Name of S3 bucket for backups (if not creating new)"
type = string
default = ""
}
variable "backup_retention_days" {
description = "Number of days to retain backups"
type = number
default = 30
validation {
condition = var.backup_retention_days >= 1 && var.backup_retention_days <= 365
error_message = "Backup retention must be between 1 and 365 days."
}
}
################################################################################
# Monitoring and Logging
################################################################################
variable "log_retention_days" {
description = "CloudWatch log retention in days"
type = number
default = 14
validation {
condition = contains([1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, 3653], var.log_retention_days)
error_message = "Log retention must be a valid CloudWatch retention period."
}
}
variable "cpu_alarm_threshold" {
description = "CPU utilization threshold for alarm (%)"
type = number
default = 80
validation {
condition = var.cpu_alarm_threshold >= 0 && var.cpu_alarm_threshold <= 100
error_message = "CPU alarm threshold must be between 0 and 100."
}
}
variable "memory_alarm_threshold" {
description = "Memory utilization threshold for alarm (%)"
type = number
default = 80
validation {
condition = var.memory_alarm_threshold >= 0 && var.memory_alarm_threshold <= 100
error_message = "Memory alarm threshold must be between 0 and 100."
}
}
variable "disk_alarm_threshold" {
description = "Disk utilization threshold for alarm (%)"
type = number
default = 85
validation {
condition = var.disk_alarm_threshold >= 0 && var.disk_alarm_threshold <= 100
error_message = "Disk alarm threshold must be between 0 and 100."
}
}
variable "alarm_sns_topic_arn" {
description = "SNS topic ARN for CloudWatch alarms"
type = string
default = ""
}
################################################################################
# Tags
################################################################################
variable "additional_tags" {
description = "Additional tags to apply to all resources"
type = map(string)
default = {}
}