variable "application_family" {
  type        = string
  description = "Application family to which this service belongs"
}

variable "environment" {
  type        = string
  description = "Available values:  dev, qa, prod."
  default     = "qa"
}

variable "service_name" {
  type        = string
  description = "Name of machine"
}

variable "additional_tags" {
  type        = map(string)
  description = "Optional map of additional tags to set on resources. These will be combined with programmatically set required tags."
  default     = {}
}

variable "secret_rotation_schedule_expression" {
  type        = string
  description = <<EOH
    Override the interval at which m2m token secret rotation will occur. Use cron() syntax.
    By default, the module will configure a cron statement to rotate the secret every 8 hours (3x/day) and
    will generate a random hour (HH) at which the schedule will begin:
      cron(0 HH/8 * * ? *)

    If you'd like to override this, please be sure to read the docs on schedule expressions:
    https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_schedule.html
    
  EOH
  default     = null
}

variable "secret_rotation_window_duration" {
  type        = string
  description = "Rotation window in hours; 2h recommended for M2M JWT rotation"
  default     = "2h"
}

locals {
  initial_jwt_access_token = {
    expires_at                    = formatdate("YYYY-MM-DD hh:mm:ss.000000ZZZZ", timestamp())
    token                         = "dummy"
    client_credentials_secret_arn = "${var.environment}/${var.service_name}/M2M_AUTH0_CLIENT_CREDENTIALS"
  }
}
