Skip to content

Commit

Permalink
Make terraform module variables nullable
Browse files Browse the repository at this point in the history
So we can have the option of leaving some parameters empty and they
pick the default value or we override the default other values when
we use the modules
  • Loading branch information
johnake committed Dec 7, 2023
1 parent af75a72 commit 47a786e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
7 changes: 7 additions & 0 deletions aks/application/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ variable "cluster_configuration_map" {

variable "replicas" {
type = number
nullable = false
default = 1
description = "Number of application instances"
}
Expand Down Expand Up @@ -64,12 +65,14 @@ variable "docker_image" {

variable "command" {
type = list(string)
nullable = false
default = []
description = "Custom command that overwrites Docker image"
}

variable "max_memory" {
type = string
nullable = false
default = "1Gi"
description = "Maximum memory of the instance"
}
Expand All @@ -82,24 +85,28 @@ variable "is_web" {

variable "web_external_hostnames" {
type = list(string)
nullable = false
default = []
description = "List of external hostnames for the web application"
}

variable "web_port" {
type = number
nullable = false
default = 3000
description = "Port of the web application"
}

variable "probe_path" {
type = string
nullable = false
default = "/healthcheck"
description = "Path for the liveness and startup probe. The probe can be disabled by setting this to null."
}

variable "probe_command" {
type = list(string)
nullable = false
default = []
description = "Command for the liveness and startup probe"
}
Expand Down
2 changes: 2 additions & 0 deletions aks/postgres/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ variable "cluster_configuration_map" {

variable "server_docker_image" {
type = string
nullable = false
default = "postgres:14-alpine"
description = "Database image to use with kubernetes deployment, eg. postgis/postgis:14-3.4"
}
Expand Down Expand Up @@ -116,6 +117,7 @@ variable "azure_enable_monitoring" {

variable "alert_window_size" {
type = string
nullable = false
default = "PT5M"
description = "The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H"
}
Expand Down
17 changes: 11 additions & 6 deletions aks/redis/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ variable "cluster_configuration_map" {

variable "server_version" {
type = string
nullable = false
default = "6"
description = "Version of Redis server"
}
Expand All @@ -71,13 +72,15 @@ variable "azure_sku_name" {
}

variable "azure_minimum_tls_version" {
type = string
default = "1.2"
type = string
nullable = false
default = "1.2"
}

variable "azure_public_network_access_enabled" {
type = bool
default = false
type = bool
nullable = false
default = false
}

variable "azure_memory_threshold" {
Expand All @@ -86,8 +89,9 @@ variable "azure_memory_threshold" {
}

variable "azure_maxmemory_policy" {
type = string
default = "allkeys-lru"
type = string
nullable = false
default = "allkeys-lru"
}

variable "azure_enable_monitoring" {
Expand All @@ -107,6 +111,7 @@ variable "azure_patch_schedule" {
variable "alert_window_size" {
type = string
default = "PT5M"
nullable = false
description = "The period of time that is used to monitor alert activity e.g PT1M, PT5M, PT15M, PT30M, PT1H, PT6H or PT12H"
}

1 change: 1 addition & 0 deletions domains/environment_domains/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ variable "host_name" {
}

variable "null_host_header" {
nullable = false
default = false
description = "The origin_host_header for the azurerm_cdn_frontdoor_origin resource will be var.host_name (if false) or null (if true). If null then the host name from the incoming request will be used."
}
Expand Down
2 changes: 2 additions & 0 deletions monitoring/statuscake/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ variable "ssl_urls" {

variable "contact_groups" {
type = list(string)
nullable = false
description = "Contact groups for the alerts"
default = []
}

variable "confirmation" {
type = number
nullable = false
description = "Retry the check when an error is detected to avoid false positives and micro downtimes"
default = 2
}

0 comments on commit 47a786e

Please sign in to comment.