variables.tf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
variable "tables" {
  description = "Map of DynamoDB table definitions"
  type = map(object({
    name                   = string
    billing_mode           = optional(string, "PAY_PER_REQUEST")
    read_capacity          = optional(number, null)
    write_capacity         = optional(number, null)
    hash_key               = string
    range_key              = optional(string, null)
    kms_key_arn            = optional(string, null)
    point_in_time_recovery = optional(bool, true)
    ttl_attribute          = optional(string, null)
    stream_enabled         = optional(bool, false)
    stream_view_type       = optional(string, "NEW_AND_OLD_IMAGES")
    table_class            = optional(string, "STANDARD")

    attributes = list(object({
      name = string
      type = string
    }))

    global_secondary_indexes = optional(list(object({
      name               = string
      hash_key           = string
      range_key          = optional(string, null)
      projection_type    = optional(string, "ALL")
      non_key_attributes = optional(list(string), [])
      read_capacity      = optional(number, null)
      write_capacity     = optional(number, null)
    })), [])

    local_secondary_indexes = optional(list(object({
      name               = string
      range_key          = string
      projection_type    = optional(string, "ALL")
      non_key_attributes = optional(list(string), [])
    })), [])

    autoscaling = optional(object({
      read_min_capacity  = optional(number, 5)
      read_max_capacity  = optional(number, 20)
      write_min_capacity = optional(number, 5)
      write_max_capacity = optional(number, 20)
      target_utilization = optional(number, 70)
    }), null)
  }))
  default = {}
}

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