variable "recorder_name" {
  description = "Name for the AWS Config recorder"
  type        = string
  default     = "org-recorder"
}

variable "s3_bucket_name" {
  description = "S3 bucket name for AWS Config delivery"
  type        = string
}

variable "s3_key_prefix" {
  description = "S3 key prefix for Config snapshots and history"
  type        = string
  default     = "config"
}

variable "sns_topic_arn" {
  description = "SNS topic ARN for Config change notifications (optional)"
  type        = string
  default     = null
}

variable "all_supported" {
  description = "Record all supported resource types"
  type        = bool
  default     = true
}

variable "include_global_resource_types" {
  description = "Include global resource types (IAM) in recording"
  type        = bool
  default     = true
}

variable "delivery_frequency" {
  description = "Frequency for Config configuration snapshots"
  type        = string
  default     = "TwentyFour_Hours"
}

variable "aggregator_name" {
  description = "Name for the organization Config aggregator"
  type        = string
  default     = "org-aggregator"
}

variable "managed_rules" {
  description = "Map of managed Config rules to deploy"
  type = map(object({
    source_identifier           = string
    description                 = string
    input_parameters            = optional(map(string), {})
    maximum_execution_frequency = optional(string, null)
  }))
  default = {
    root_mfa_enabled = {
      source_identifier = "ROOT_ACCOUNT_MFA_ENABLED"
      description       = "Ensure MFA is enabled for the root account"
    }
    iam_password_policy = {
      source_identifier = "IAM_PASSWORD_POLICY"
      description       = "Ensure IAM password policy meets minimum requirements"
      input_parameters = {
        RequireUppercaseCharacters = "true"
        RequireLowercaseCharacters = "true"
        RequireSymbols             = "true"
        RequireNumbers             = "true"
        MinimumPasswordLength      = "14"
        PasswordReusePrevention    = "24"
        MaxPasswordAge             = "90"
      }
    }
    cloudtrail_enabled = {
      source_identifier = "CLOUD_TRAIL_ENABLED"
      description       = "Ensure CloudTrail is enabled"
    }
    s3_bucket_public_access = {
      source_identifier = "S3_ACCOUNT_LEVEL_PUBLIC_ACCESS_BLOCKS"
      description       = "Ensure S3 account-level public access blocks are enabled"
    }
    ebs_encryption = {
      source_identifier = "EC2_EBS_ENCRYPTION_BY_DEFAULT"
      description       = "Ensure EBS encryption by default is enabled"
    }
    guardduty_enabled = {
      source_identifier = "GUARDDUTY_ENABLED_CENTRALIZED"
      description       = "Ensure GuardDuty is enabled"
    }
  }
}

variable "conformance_packs" {
  description = "Map of conformance pack names to S3 template URI or inline template body"
  type = map(object({
    template_body    = optional(string, null)
    template_s3_uri  = optional(string, null)
    input_parameters = optional(map(string), {})
  }))
  default = {}
}

variable "tags" {
  description = "Resource tags to apply to all resources"
  type        = map(string)
  default     = {}
}
