|
| 1 | +variable "name" { |
| 2 | + description = "The name of the PostgreSQL Flexible Server." |
| 3 | + type = string |
| 4 | +} |
| 5 | + |
| 6 | +variable "resource_group_name" { |
| 7 | + description = "The name of the resource group in which to create the PostgreSQL Flexible Server." |
| 8 | + type = string |
| 9 | +} |
| 10 | + |
| 11 | +variable "location" { |
| 12 | + description = "The location/region where the PostgreSQL Flexible Server is created." |
| 13 | + type = string |
| 14 | +} |
| 15 | + |
| 16 | +variable "backup_retention_days" { |
| 17 | + description = "The number of days to retain backups for the PostgreSQL Flexible Server." |
| 18 | + type = number |
| 19 | +} |
| 20 | + |
| 21 | +variable "geo_redundant_backup_enabled" { |
| 22 | + description = "Whether geo-redundant backup is enabled for the PostgreSQL Flexible Server." |
| 23 | + type = bool |
| 24 | +} |
| 25 | + |
| 26 | +variable "postgresql_admin_object_id" { |
| 27 | + description = "The object ID of the PostgreSQL Active Directory administrator." |
| 28 | + type = string |
| 29 | +} |
| 30 | + |
| 31 | +variable "postgresql_admin_principal_name" { |
| 32 | + description = "The principal name of the PostgreSQL Active Directory administrator." |
| 33 | + type = string |
| 34 | +} |
| 35 | + |
| 36 | +variable "postgresql_admin_principal_type" { |
| 37 | + description = "The principal type of the PostgreSQL Active Directory administrator." |
| 38 | + type = string |
| 39 | +} |
| 40 | + |
| 41 | +variable "public_network_access_enabled" { |
| 42 | + description = "Whether public network access is enabled for the PostgreSQL Flexible Server." |
| 43 | + type = bool |
| 44 | + default = false |
| 45 | +} |
| 46 | + |
| 47 | +variable "sku_name" { |
| 48 | + # See: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server#sku_name-2 |
| 49 | + description = "The SKU name for the PostgreSQL Flexible Server." |
| 50 | + type = string |
| 51 | +} |
| 52 | + |
| 53 | +variable "storage_mb" { |
| 54 | + # See: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server#storage_mb-2 |
| 55 | + description = "The storage size in MB for the PostgreSQL Flexible Server." |
| 56 | + type = number |
| 57 | + default = 32768 |
| 58 | + |
| 59 | + validation { |
| 60 | + condition = contains([32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4193280, 4194304, 8388608, 16777216, 33553408], var.storage_mb) |
| 61 | + error_message = "The storage size must be one of the following: 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4193280, 4194304, 8388608, 16777216, 33553408." |
| 62 | + } |
| 63 | +} |
| 64 | + |
| 65 | +variable "storage_tier" { |
| 66 | + # See defaults: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server#storage_tier-defaults-based-on-storage_mb |
| 67 | + description = "The storage tier for the PostgreSQL Flexible Server." |
| 68 | + type = string |
| 69 | + default = "P4" |
| 70 | + |
| 71 | + validation { |
| 72 | + condition = contains(["P4", "P6", "P10", "P15", "P20", "P30", "P40", "P50", "P60", "P70", "P80"], var.storage_tier) |
| 73 | + error_message = "The storage tier must be one of the following: P4, P6, P10, P15, P20, P30, P40, P50, P60, P70, P80." |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +variable "server_version" { |
| 78 | + description = "The version of the PostgreSQL server." |
| 79 | + type = string |
| 80 | + default = "16" |
| 81 | + |
| 82 | + validation { |
| 83 | + condition = contains(["11", "12", "13", "14", "15", "16"], var.server_version) |
| 84 | + error_message = "The server version must be one of the following: 11, 12, 13, 14, 15, 16." |
| 85 | + } |
| 86 | +} |
| 87 | + |
| 88 | +variable "tenant_id" { |
| 89 | + description = "The tenant ID for the Azure Active Directory." |
| 90 | + type = string |
| 91 | +} |
| 92 | + |
| 93 | +variable "zone" { |
| 94 | + # See: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/postgresql_flexible_server#zone-2 |
| 95 | + description = "The availability zone for the PostgreSQL Flexible Server. Azure will automatically assign an Availability Zone if one is not specified." |
| 96 | + type = string |
| 97 | + default = null |
| 98 | +} |
| 99 | + |
| 100 | +variable "tags" { |
| 101 | + description = "A map of tags to assign to the PostgreSQL Flexible Server." |
| 102 | + type = map(string) |
| 103 | +} |
| 104 | + |
| 105 | +# Databases |
| 106 | +variable "databases" { |
| 107 | + description = "A map of databases to create on the PostgreSQL Flexible Server." |
| 108 | + type = map(object({ |
| 109 | + collation = string |
| 110 | + charset = string |
| 111 | + max_size_gb = number |
| 112 | + name = string |
| 113 | + })) |
| 114 | +} |
| 115 | + |
| 116 | +# Server configurations |
| 117 | +variable "postgresql_configurations" { |
| 118 | + description = "A map of PostgreSQL configurations to apply to the PostgreSQL Flexible Server." |
| 119 | + type = map(string) |
| 120 | + default = {} |
| 121 | +} |
| 122 | + |
| 123 | +# Private Endpoint Properties |
| 124 | +variable "private_endpoint_properties" { |
| 125 | + description = "Consolidated properties for the PostgreSql Private Endpoint." |
| 126 | + type = object({ |
| 127 | + private_dns_zone_ids_postgresql = optional(list(string), []) |
| 128 | + private_endpoint_enabled = optional(bool, false) |
| 129 | + private_endpoint_subnet_id = optional(string, "") |
| 130 | + private_endpoint_resource_group_name = optional(string, "") |
| 131 | + private_service_connection_is_manual = optional(bool, false) |
| 132 | + }) |
| 133 | +} |
| 134 | + |
| 135 | +# /* -------------------------------------------------------------------------------------------------- |
| 136 | +# Auditing and Diagnostics Variables |
| 137 | +# -------------------------------------------------------------------------------------------------- */ |
| 138 | +# variable "monitor_diagnostic_setting_database_enabled_logs" { |
| 139 | +# type = list(string) |
| 140 | +# description = "Controls what logs will be enabled for the database" |
| 141 | +# } |
| 142 | + |
| 143 | +# variable "monitor_diagnostic_setting_database_metrics" { |
| 144 | +# type = list(string) |
| 145 | +# description = "Controls what metrics will be enabled for the database" |
| 146 | +# } |
0 commit comments