diff --git a/modules/alloydb/README.md b/modules/alloydb/README.md
index a26616473c..ac2083885c 100644
--- a/modules/alloydb/README.md
+++ b/modules/alloydb/README.md
@@ -5,7 +5,8 @@ It can also create an initial set of users via the `users` parameters.
Note that this module assumes that some options are the same for both the primary instance and the secondary one in case of cross regional replication configuration.
-*Warning:* if you use the `users` field, you terraform state will contain each user's password in plain text.
+> [!WARNING]
+> If you use the `users` field, you terraform state will contain each user's password in plain text.
* [AlloyDB module](#alloydb-module)
@@ -45,13 +46,11 @@ module "vpc" {
ranges = { alloydb = "10.60.0.0/16" }
deletion_policy = "ABANDON"
}]
- subnets_psc = [
- {
- ip_cidr_range = "10.0.3.0/24"
- name = "psc"
- region = var.region
- }
- ]
+ subnets_psc = [{
+ ip_cidr_range = "10.0.3.0/24"
+ name = "psc"
+ region = var.region
+ }]
}
module "alloydb" {
@@ -145,43 +144,48 @@ module "alloydb" {
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
-| [cluster_name](variables.tf#L87) | Name of the primary cluster. | string
| ✓ | |
-| [location](variables.tf#L168) | Region or zone of the cluster and instance. | string
| ✓ | |
-| [name](variables.tf#L224) | Name of primary instance. | string
| ✓ | |
-| [network_config](variables.tf#L229) | Network configuration for cluster and instance. Only one between cluster_network_config and cluster_psc_config can be used. | object({…})
| ✓ | |
-| [project_id](variables.tf#L254) | The ID of the project where this instances will be created. | string
| ✓ | |
-| [automated_backup_configuration](variables.tf#L17) | Automated backup settings for cluster. | object({…})
| | {…}
|
-| [availability_type](variables.tf#L70) | Availability type for the primary replica. Either `ZONAL` or `REGIONAL`. | string
| | "REGIONAL"
|
-| [client_connection_config](variables.tf#L76) | Client connection config. | object({…})
| | null
|
-| [continuous_backup_configuration](variables.tf#L92) | Continuous backup settings for cluster. | object({…})
| | {…}
|
-| [cross_region_replication](variables.tf#L105) | Cross region replication config. | object({…})
| | {}
|
-| [database_version](variables.tf#L119) | Database type and version to create. | string
| | "POSTGRES_15"
|
-| [deletion_policy](variables.tf#L125) | AlloyDB cluster and instance deletion policy. | string
| | null
|
-| [encryption_config](variables.tf#L131) | Set encryption configuration. KMS name format: 'projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]'. | object({…})
| | null
|
-| [flags](variables.tf#L141) | Map FLAG_NAME=>VALUE for database-specific tuning. | map(string)
| | null
|
-| [gce_zone](variables.tf#L147) | The GCE zone that the instance should serve from. This can ONLY be specified for ZONAL instances. If present for a REGIONAL instance, an error will be thrown. | string
| | null
|
-| [initial_user](variables.tf#L153) | AlloyDB cluster initial user credentials. | object({…})
| | null
|
-| [labels](variables.tf#L162) | Labels to be attached to all instances. | map(string)
| | null
|
-| [machine_config](variables.tf#L173) | AlloyDB machine config. | object({…})
| | {…}
|
-| [maintenance_config](variables.tf#L184) | Set maintenance window configuration. | object({…})
| | {…}
|
-| [prefix](variables.tf#L244) | Optional prefix used to generate instance names. | string
| | null
|
-| [query_insights_config](variables.tf#L259) | Query insights config. | object({…})
| | {…}
|
-| [secondary_cluster_name](variables.tf#L275) | Name of secondary cluster instance. | string
| | null
|
-| [secondary_name](variables.tf#L281) | Name of secondary instance. | string
| | null
|
-| [users](variables.tf#L287) | Map of users to create in the primary instance (and replicated to other replicas). Set PASSWORD to null if you want to get an autogenerated password. The user types available are: 'ALLOYDB_BUILT_IN' or 'ALLOYDB_IAM_USER'. | map(object({…}))
| | null
|
+| [cluster_name](variables.tf#L99) | Name of the primary cluster. | string
| ✓ | |
+| [location](variables.tf#L186) | Region or zone of the cluster and instance. | string
| ✓ | |
+| [name](variables.tf#L242) | Name of primary instance. | string
| ✓ | |
+| [network_config](variables.tf#L247) | Network configuration for cluster and instance. Only one between cluster_network_config and cluster_psc_config can be used. | object({…})
| ✓ | |
+| [project_id](variables.tf#L272) | The ID of the project where this instances will be created. | string
| ✓ | |
+| [annotations](variables.tf#L17) | Map FLAG_NAME=>VALUE for annotations which allow client tools to store small amount of arbitrary data. | map(string)
| | null
|
+| [automated_backup_configuration](variables.tf#L23) | Automated backup settings for cluster. | object({…})
| | {…}
|
+| [availability_type](variables.tf#L76) | Availability type for the primary replica. Either `ZONAL` or `REGIONAL`. | string
| | "REGIONAL"
|
+| [client_connection_config](variables.tf#L82) | Client connection config. | object({…})
| | null
|
+| [cluster_display_name](variables.tf#L93) | Display name of the primary cluster. | string
| | null
|
+| [continuous_backup_configuration](variables.tf#L104) | Continuous backup settings for cluster. | object({…})
| | {…}
|
+| [cross_region_replication](variables.tf#L117) | Cross region replication config. | object({…})
| | {}
|
+| [database_version](variables.tf#L131) | Database type and version to create. | string
| | "POSTGRES_15"
|
+| [deletion_policy](variables.tf#L137) | AlloyDB cluster and instance deletion policy. | string
| | null
|
+| [display_name](variables.tf#L143) | AlloyDB instance display name. | string
| | null
|
+| [encryption_config](variables.tf#L149) | Set encryption configuration. KMS name format: 'projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]'. | object({…})
| | null
|
+| [flags](variables.tf#L159) | Map FLAG_NAME=>VALUE for database-specific tuning. | map(string)
| | null
|
+| [gce_zone](variables.tf#L165) | The GCE zone that the instance should serve from. This can ONLY be specified for ZONAL instances. If present for a REGIONAL instance, an error will be thrown. | string
| | null
|
+| [initial_user](variables.tf#L171) | AlloyDB cluster initial user credentials. | object({…})
| | null
|
+| [labels](variables.tf#L180) | Labels to be attached to all instances. | map(string)
| | null
|
+| [machine_config](variables.tf#L191) | AlloyDB machine config. | object({…})
| | {…}
|
+| [maintenance_config](variables.tf#L202) | Set maintenance window configuration. | object({…})
| | {…}
|
+| [prefix](variables.tf#L262) | Optional prefix used to generate instance names. | string
| | null
|
+| [query_insights_config](variables.tf#L277) | Query insights config. | object({…})
| | {…}
|
+| [secondary_cluster_display_name](variables.tf#L293) | Display name of secondary cluster instance. | string
| | null
|
+| [secondary_cluster_name](variables.tf#L299) | Name of secondary cluster instance. | string
| | null
|
+| [secondary_display_name](variables.tf#L305) | Display name of secondary instance. | string
| | null
|
+| [secondary_name](variables.tf#L311) | Name of secondary instance. | string
| | null
|
+| [users](variables.tf#L317) | Map of users to create in the primary instance (and replicated to other replicas). Set PASSWORD to null if you want to get an autogenerated password. The user types available are: 'ALLOYDB_BUILT_IN' or 'ALLOYDB_IAM_USER'. | map(object({…}))
| | null
|
## Outputs
| name | description | sensitive |
|---|---|:---:|
-| [id](outputs.tf#L25) | Fully qualified primary instance id. | |
-| [ids](outputs.tf#L30) | Fully qualified ids of all instances. | |
-| [instances](outputs.tf#L38) | AlloyDB instance resources. | ✓ |
-| [ip](outputs.tf#L44) | IP address of the primary instance. | |
-| [ips](outputs.tf#L49) | IP addresses of all instances. | |
-| [name](outputs.tf#L56) | Name of the primary instance. | |
-| [names](outputs.tf#L61) | Names of all instances. | |
-| [secondary_id](outputs.tf#L69) | Fully qualified primary instance id. | |
-| [secondary_ip](outputs.tf#L74) | IP address of the primary instance. | |
-| [user_passwords](outputs.tf#L79) | Map of containing the password of all users created through terraform. | ✓ |
+| [id](outputs.tf#L28) | Fully qualified primary instance id. | |
+| [ids](outputs.tf#L33) | Fully qualified ids of all instances. | |
+| [instances](outputs.tf#L41) | AlloyDB instance resources. | ✓ |
+| [ip](outputs.tf#L47) | IP address of the primary instance. | |
+| [ips](outputs.tf#L52) | IP addresses of all instances. | |
+| [name](outputs.tf#L59) | Name of the primary instance. | |
+| [names](outputs.tf#L64) | Names of all instances. | |
+| [secondary_id](outputs.tf#L72) | Fully qualified primary instance id. | |
+| [secondary_ip](outputs.tf#L77) | IP address of the primary instance. | |
+| [user_passwords](outputs.tf#L82) | Map of containing the password of all users created through terraform. | ✓ |
diff --git a/modules/alloydb/main.tf b/modules/alloydb/main.tf
index 748dfe9367..23cbe66bff 100644
--- a/modules/alloydb/main.tf
+++ b/modules/alloydb/main.tf
@@ -17,9 +17,11 @@
locals {
prefix = var.prefix == null ? "" : "${var.prefix}-"
# has_replicas = try(length(var.replicas) > 0, false)
- is_regional = var.availability_type == "REGIONAL" ? true : false
+ is_regional = var.availability_type == "REGIONAL"
# secondary instance type is aligned with cluster type unless apply is targeting a promotion, in that
# case cluster will be 'primary' while instance still 'secondary'.
+ primary_cluster_name = "${local.prefix}${var.cluster_name}"
+ primary_instance_name = "${local.prefix}${var.name}"
secondary_cluster_name = coalesce(var.secondary_cluster_name, "${var.cluster_name}-sec")
secondary_instance_name = coalesce(var.secondary_name, "${var.name}-sec")
secondary_instance_type = try(var.cross_region_replication.promote_secondary && google_alloydb_cluster.secondary[0].cluster_type == "SECONDARY" ? "SECONDARY" : google_alloydb_cluster.secondary[0].cluster_type, null)
@@ -36,9 +38,12 @@ locals {
resource "google_alloydb_cluster" "primary" {
project = var.project_id
- cluster_id = "${local.prefix}${var.cluster_name}"
+ annotations = var.annotations
+ cluster_id = local.primary_cluster_name
+ cluster_type = "PRIMARY"
database_version = var.database_version
deletion_policy = var.deletion_policy
+ display_name = coalesce(var.cluster_display_name, local.primary_cluster_name)
labels = var.labels
location = var.location
@@ -48,7 +53,7 @@ resource "google_alloydb_cluster" "primary" {
}
dynamic "automated_backup_policy" {
- for_each = var.automated_backup_configuration.enabled ? { 1 = 1 } : {}
+ for_each = var.automated_backup_configuration.enabled ? [""] : []
content {
enabled = true
location = try(var.automated_backup_configuration.location, var.location)
@@ -56,7 +61,7 @@ resource "google_alloydb_cluster" "primary" {
labels = var.labels
dynamic "encryption_config" {
- for_each = var.encryption_config != null ? { 1 = 1 } : {}
+ for_each = var.encryption_config != null ? [""] : []
content {
kms_key_name = var.encryption_config.primary_kms_key_name
}
@@ -73,14 +78,14 @@ resource "google_alloydb_cluster" "primary" {
}
dynamic "quantity_based_retention" {
- for_each = var.automated_backup_configuration.retention_count != null ? { 1 = 1 } : {}
+ for_each = var.automated_backup_configuration.retention_count != null ? [""] : []
content {
count = var.automated_backup_configuration.retention_count
}
}
dynamic "time_based_retention" {
- for_each = var.automated_backup_configuration.retention_period != null ? { 1 = 1 } : {}
+ for_each = var.automated_backup_configuration.retention_period != null ? [""] : []
content {
retention_period = var.automated_backup_configuration.retention_period
}
@@ -89,12 +94,12 @@ resource "google_alloydb_cluster" "primary" {
}
dynamic "continuous_backup_config" {
- for_each = var.continuous_backup_configuration.enabled ? { 1 = 1 } : {}
+ for_each = var.continuous_backup_configuration.enabled ? [""] : []
content {
enabled = true
recovery_window_days = var.continuous_backup_configuration.recovery_window_days
dynamic "encryption_config" {
- for_each = var.encryption_config != null ? { 1 = 1 } : {}
+ for_each = var.encryption_config != null ? [""] : []
content {
kms_key_name = var.encryption_config.primary_kms_key_name
}
@@ -103,14 +108,14 @@ resource "google_alloydb_cluster" "primary" {
}
dynamic "encryption_config" {
- for_each = var.encryption_config != null ? { 1 = 1 } : {}
+ for_each = var.encryption_config != null ? [""] : []
content {
kms_key_name = var.encryption_config.primary_kms_key_name
}
}
dynamic "initial_user" {
- for_each = var.initial_user != null ? { 1 = 1 } : {}
+ for_each = var.initial_user != null ? [""] : []
content {
user = var.initial_user.user
password = var.initial_user.password
@@ -118,7 +123,7 @@ resource "google_alloydb_cluster" "primary" {
}
dynamic "maintenance_update_policy" {
- for_each = var.maintenance_config.enabled ? { 1 = 1 } : {}
+ for_each = var.maintenance_config.enabled ? [""] : []
content {
maintenance_windows {
day = var.maintenance_config.day
@@ -134,21 +139,22 @@ resource "google_alloydb_cluster" "primary" {
}
resource "google_alloydb_instance" "primary" {
- cluster = google_alloydb_cluster.primary.id
+ annotations = var.annotations
availability_type = var.availability_type
+ cluster = google_alloydb_cluster.primary.id
database_flags = var.flags
- display_name = "${local.prefix}${var.name}"
- instance_id = "${local.prefix}${var.name}"
+ display_name = coalesce(var.display_name, local.primary_instance_name)
+ instance_id = local.primary_instance_name
instance_type = "PRIMARY"
gce_zone = local.is_regional ? null : var.gce_zone
labels = var.labels
dynamic "client_connection_config" {
- for_each = var.client_connection_config != null ? { 1 = 1 } : {}
+ for_each = var.client_connection_config != null ? [""] : []
content {
require_connectors = var.client_connection_config.require_connectors
dynamic "ssl_config" {
- for_each = var.client_connection_config.ssl_config != null ? { 1 = 1 } : {}
+ for_each = var.client_connection_config.ssl_config != null ? [""] : []
content {
ssl_mode = var.client_connection_config.ssl_config.ssl_mode
}
@@ -157,14 +163,14 @@ resource "google_alloydb_instance" "primary" {
}
dynamic "machine_config" {
- for_each = var.machine_config != null ? { 1 = 1 } : {}
+ for_each = var.machine_config != null ? [""] : []
content {
cpu_count = var.machine_config.cpu_count
}
}
dynamic "network_config" {
- for_each = var.network_config != null ? { 1 = 1 } : {}
+ for_each = var.network_config != null ? [""] : []
content {
dynamic "authorized_external_networks" {
for_each = coalesce(var.network_config.authorized_external_networks, [])
@@ -177,7 +183,7 @@ resource "google_alloydb_instance" "primary" {
}
dynamic "query_insights_config" {
- for_each = var.query_insights_config != null ? { 1 = 1 } : {}
+ for_each = var.query_insights_config != null ? [""] : []
content {
query_string_length = var.query_insights_config.query_string_length
record_application_tags = var.query_insights_config.record_application_tags
@@ -190,10 +196,12 @@ resource "google_alloydb_instance" "primary" {
resource "google_alloydb_cluster" "secondary" {
count = var.cross_region_replication.enabled ? 1 : 0
project = var.project_id
+ annotations = var.annotations
cluster_id = local.secondary_cluster_name
cluster_type = var.cross_region_replication.promote_secondary ? "PRIMARY" : "SECONDARY"
database_version = var.database_version
deletion_policy = "FORCE"
+ display_name = coalesce(var.secondary_cluster_display_name, local.secondary_cluster_name)
labels = var.labels
location = var.cross_region_replication.region
@@ -203,7 +211,7 @@ resource "google_alloydb_cluster" "secondary" {
}
dynamic "automated_backup_policy" {
- for_each = var.automated_backup_configuration.enabled ? { 1 = 1 } : {}
+ for_each = var.automated_backup_configuration.enabled ? [""] : []
content {
enabled = true
location = var.cross_region_replication.region
@@ -211,7 +219,7 @@ resource "google_alloydb_cluster" "secondary" {
labels = var.labels
dynamic "encryption_config" {
- for_each = var.encryption_config != null ? { 1 = 1 } : {}
+ for_each = var.encryption_config != null ? [""] : []
content {
kms_key_name = var.encryption_config.secondary_kms_key_name
}
@@ -228,14 +236,14 @@ resource "google_alloydb_cluster" "secondary" {
}
dynamic "quantity_based_retention" {
- for_each = var.automated_backup_configuration.retention_count != null ? { 1 = 1 } : {}
+ for_each = var.automated_backup_configuration.retention_count != null ? [""] : []
content {
count = var.automated_backup_configuration.retention_count
}
}
dynamic "time_based_retention" {
- for_each = var.automated_backup_configuration.retention_period != null ? { 1 = 1 } : {}
+ for_each = var.automated_backup_configuration.retention_period != null ? [""] : []
content {
retention_period = var.automated_backup_configuration.retention_period
}
@@ -244,12 +252,12 @@ resource "google_alloydb_cluster" "secondary" {
}
dynamic "continuous_backup_config" {
- for_each = var.continuous_backup_configuration.enabled ? { 1 = 1 } : {}
+ for_each = var.continuous_backup_configuration.enabled ? [""] : []
content {
enabled = true
recovery_window_days = var.continuous_backup_configuration.recovery_window_days
dynamic "encryption_config" {
- for_each = var.encryption_config != null ? { 1 = 1 } : {}
+ for_each = var.encryption_config != null ? [""] : []
content {
kms_key_name = var.encryption_config.secondary_kms_key_name
}
@@ -258,14 +266,14 @@ resource "google_alloydb_cluster" "secondary" {
}
dynamic "encryption_config" {
- for_each = var.encryption_config != null ? { 1 = 1 } : {}
+ for_each = var.encryption_config != null ? [""] : []
content {
kms_key_name = var.encryption_config.secondary_kms_key_name
}
}
dynamic "initial_user" {
- for_each = var.initial_user != null ? { 1 = 1 } : {}
+ for_each = var.initial_user != null ? [""] : []
content {
user = var.initial_user.user
password = var.initial_user.password
@@ -273,7 +281,7 @@ resource "google_alloydb_cluster" "secondary" {
}
dynamic "maintenance_update_policy" {
- for_each = var.maintenance_config.enabled ? { 1 = 1 } : {}
+ for_each = var.maintenance_config.enabled ? [""] : []
content {
maintenance_windows {
day = var.maintenance_config.day
@@ -288,7 +296,7 @@ resource "google_alloydb_cluster" "secondary" {
}
dynamic "secondary_config" {
- for_each = var.cross_region_replication.promote_secondary ? {} : { 1 = 1 }
+ for_each = var.cross_region_replication.promote_secondary ? [""] : []
content {
primary_cluster_name = google_alloydb_cluster.primary.id
}
@@ -299,21 +307,22 @@ resource "google_alloydb_cluster" "secondary" {
resource "google_alloydb_instance" "secondary" {
count = var.cross_region_replication.enabled ? 1 : 0
+ annotations = var.annotations
availability_type = var.availability_type
cluster = google_alloydb_cluster.secondary[0].id
database_flags = var.cross_region_replication.promote_secondary ? var.flags : null
- display_name = local.secondary_instance_name
+ display_name = coalesce(var.secondary_display_name, local.secondary_instance_name)
gce_zone = local.is_regional ? null : var.gce_zone
instance_id = local.secondary_instance_name
instance_type = local.secondary_instance_type
labels = var.labels
dynamic "client_connection_config" {
- for_each = var.client_connection_config != null ? { 1 = 1 } : {}
+ for_each = var.client_connection_config != null ? [""] : []
content {
require_connectors = var.client_connection_config.require_connectors
dynamic "ssl_config" {
- for_each = var.client_connection_config.ssl_config != null ? { 1 = 1 } : {}
+ for_each = var.client_connection_config.ssl_config != null ? [""] : []
content {
ssl_mode = var.client_connection_config.ssl_config.ssl_mode
}
@@ -322,14 +331,14 @@ resource "google_alloydb_instance" "secondary" {
}
dynamic "machine_config" {
- for_each = var.machine_config != null ? { 1 = 1 } : {}
+ for_each = var.machine_config != null ? [""] : []
content {
cpu_count = var.machine_config.cpu_count
}
}
dynamic "network_config" {
- for_each = var.network_config != null ? { 1 = 1 } : {}
+ for_each = var.network_config != null ? [""] : []
content {
dynamic "authorized_external_networks" {
for_each = coalesce(var.network_config.authorized_external_networks, [])
@@ -342,7 +351,7 @@ resource "google_alloydb_instance" "secondary" {
}
dynamic "query_insights_config" {
- for_each = var.query_insights_config != null ? { 1 = 1 } : {}
+ for_each = var.query_insights_config != null ? [""] : []
content {
query_string_length = var.query_insights_config.query_string_length
record_application_tags = var.query_insights_config.record_application_tags
diff --git a/modules/alloydb/outputs.tf b/modules/alloydb/outputs.tf
index e3f9da1fce..369a177373 100644
--- a/modules/alloydb/outputs.tf
+++ b/modules/alloydb/outputs.tf
@@ -19,7 +19,10 @@ locals {
# { primary = google_alloydb_instance.primary },
# google_alloydb_instance.replicas
# )
- _all_instances = merge({ primary = google_alloydb_instance.primary }, var.cross_region_replication.enabled ? { secondary = google_alloydb_instance.secondary[0] } : {})
+ _all_instances = {
+ primary = google_alloydb_instance.primary
+ secondary = one(google_alloydb_instance.secondary)
+ }
}
output "id" {
@@ -31,7 +34,7 @@ output "ids" {
description = "Fully qualified ids of all instances."
value = {
for id, instance in local._all_instances :
- id => instance.id
+ id => try(instance.id, null)
}
}
@@ -49,7 +52,7 @@ output "ip" {
output "ips" {
description = "IP addresses of all instances."
value = {
- for id, instance in local._all_instances : id => instance.ip_address
+ for id, instance in local._all_instances : id => try(instance.ip_address, null)
}
}
@@ -62,7 +65,7 @@ output "names" {
description = "Names of all instances."
value = {
for id, instance in local._all_instances :
- id => instance.name
+ id => try(instance.name, null)
}
}
diff --git a/modules/alloydb/variables.tf b/modules/alloydb/variables.tf
index 4f7a24ef53..fac5205be3 100644
--- a/modules/alloydb/variables.tf
+++ b/modules/alloydb/variables.tf
@@ -14,6 +14,12 @@
* limitations under the License.
*/
+variable "annotations" {
+ description = "Map FLAG_NAME=>VALUE for annotations which allow client tools to store small amount of arbitrary data."
+ type = map(string)
+ default = null
+}
+
variable "automated_backup_configuration" {
description = "Automated backup settings for cluster."
nullable = false
@@ -84,6 +90,12 @@ variable "client_connection_config" {
default = null
}
+variable "cluster_display_name" {
+ description = "Display name of the primary cluster."
+ type = string
+ default = null
+}
+
variable "cluster_name" {
description = "Name of the primary cluster."
type = string
@@ -128,6 +140,12 @@ variable "deletion_policy" {
default = null
}
+variable "display_name" {
+ description = "AlloyDB instance display name."
+ type = string
+ default = null
+}
+
variable "encryption_config" {
description = "Set encryption configuration. KMS name format: 'projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]'."
type = object({
@@ -272,12 +290,24 @@ variable "query_insights_config" {
}
}
+variable "secondary_cluster_display_name" {
+ description = "Display name of secondary cluster instance."
+ type = string
+ default = null
+}
+
variable "secondary_cluster_name" {
description = "Name of secondary cluster instance."
type = string
default = null
}
+variable "secondary_display_name" {
+ description = "Display name of secondary instance."
+ type = string
+ default = null
+}
+
variable "secondary_name" {
description = "Name of secondary instance."
type = string
diff --git a/tests/modules/alloydb/examples/cmek.yaml b/tests/modules/alloydb/examples/cmek.yaml
index f1880e47c2..ebc60c1e24 100644
--- a/tests/modules/alloydb/examples/cmek.yaml
+++ b/tests/modules/alloydb/examples/cmek.yaml
@@ -24,7 +24,7 @@ values:
recovery_window_days: 14
database_version: POSTGRES_15
deletion_policy: DEFAULT
- display_name: null
+ display_name: primary
encryption_config:
- kms_key_name: kms_key_self_link
etag: null
diff --git a/tests/modules/alloydb/examples/cross_region_replication.yaml b/tests/modules/alloydb/examples/cross_region_replication.yaml
index e048ef892a..51d9fc5ca3 100644
--- a/tests/modules/alloydb/examples/cross_region_replication.yaml
+++ b/tests/modules/alloydb/examples/cross_region_replication.yaml
@@ -23,7 +23,7 @@ values:
recovery_window_days: 14
database_version: POSTGRES_15
deletion_policy: DEFAULT
- display_name: null
+ display_name: db
encryption_config: []
etag: null
initial_user: []
@@ -48,7 +48,7 @@ values:
recovery_window_days: 14
database_version: POSTGRES_15
deletion_policy: FORCE
- display_name: null
+ display_name: db-sec
encryption_config: []
etag: null
initial_user: []
@@ -61,8 +61,7 @@ values:
project: project-id
restore_backup_source: []
restore_continuous_backup_source: []
- secondary_config:
- - {}
+ secondary_config: []
timeouts: null
module.alloydb.google_alloydb_instance.primary:
annotations: null
diff --git a/tests/modules/alloydb/examples/custom.yaml b/tests/modules/alloydb/examples/custom.yaml
index cf6417ccda..a2bcf0b4ef 100644
--- a/tests/modules/alloydb/examples/custom.yaml
+++ b/tests/modules/alloydb/examples/custom.yaml
@@ -23,7 +23,7 @@ values:
recovery_window_days: 14
database_version: POSTGRES_15
deletion_policy: DEFAULT
- display_name: null
+ display_name: primary
encryption_config: []
etag: null
initial_user: []
@@ -99,4 +99,4 @@ counts:
random_password: 1
resources: 5
-outputs: {}
\ No newline at end of file
+outputs: {}
diff --git a/tests/modules/alloydb/examples/simple.yaml b/tests/modules/alloydb/examples/simple.yaml
index 7d8639ae9c..7f658a69c1 100644
--- a/tests/modules/alloydb/examples/simple.yaml
+++ b/tests/modules/alloydb/examples/simple.yaml
@@ -23,7 +23,7 @@ values:
recovery_window_days: 14
database_version: POSTGRES_15
deletion_policy: DEFAULT
- display_name: null
+ display_name: db
encryption_config: []
etag: null
initial_user: []