diff --git a/modules/alloydb/README.md b/modules/alloydb/README.md
index 18657fe8a..c0a778183 100644
--- a/modules/alloydb/README.md
+++ b/modules/alloydb/README.md
@@ -61,13 +61,16 @@ module "alloydb" {
project_id = module.project.project_id
project_number = var.project_number
cluster_name = "db"
+ instance_name = "db"
+ location = var.region
+ initial_user = {
+ password = "changeit"
+ }
network_config = {
psa_config = {
network = module.vpc.id
}
}
- instance_name = "db"
- location = var.region
deletion_protection = false
}
# tftest modules=3 resources=17 inventory=simple.yaml e2e
@@ -85,6 +88,9 @@ module "alloydb" {
cluster_name = "db"
location = var.region
instance_name = "db"
+ initial_user = {
+ password = "changeit"
+ }
network_config = {
psa_config = {
network = var.vpc.id
@@ -96,6 +102,7 @@ module "alloydb" {
node_count = 2
}
}
+
deletion_protection = false
}
# tftest modules=1 resources=4 inventory=read_pool.yaml e2e
@@ -111,6 +118,9 @@ module "alloydb" {
cluster_name = "db"
location = var.region
instance_name = "db"
+ initial_user = {
+ password = "changeit"
+ }
network_config = {
psa_config = {
network = var.vpc.id
@@ -120,6 +130,7 @@ module "alloydb" {
enabled = true
region = "europe-west12"
}
+
deletion_protection = false
}
# tftest modules=1 resources=4 inventory=cross_region_replication.yaml e2e
@@ -141,9 +152,13 @@ module "alloydb" {
cluster_name = "db"
location = var.region
instance_name = "db"
+ initial_user = {
+ password = "changeit"
+ }
network_config = {
psc_config = { allowed_consumer_projects = [var.project_number] }
}
+
deletion_protection = false
}
# tftest modules=1 resources=2 inventory=psc.yaml e2e
@@ -165,6 +180,9 @@ module "alloydb" {
idle_in_transaction_session_timeout = "900000"
timezone = "'UTC'"
}
+ initial_user = {
+ password = "changeit"
+ }
network_config = {
psa_config = {
network = var.vpc.id
@@ -180,6 +198,7 @@ module "alloydb" {
password = "mypassword"
}
}
+
deletion_protection = false
}
# tftest modules=1 resources=5 inventory=custom.yaml e2e
@@ -243,6 +262,9 @@ module "alloydb" {
cluster_name = "primary"
location = var.region
instance_name = "primary"
+ initial_user = {
+ password = "changeit"
+ }
network_config = {
psa_config = {
network = module.vpc.id
@@ -251,6 +273,7 @@ module "alloydb" {
encryption_config = {
primary_kms_key_name = module.kms.keys.key-regional.id
}
+
deletion_protection = false
}
@@ -284,6 +307,9 @@ module "alloydb" {
cluster_name = "primary"
location = var.region
instance_name = "primary"
+ initial_user = {
+ password = "changeit"
+ }
network_config = {
psa_config = {
network = var.vpc.id
@@ -302,10 +328,11 @@ module "alloydb" {
| name | description | type | required | default |
|---|---|:---:|:---:|:---:|
| [cluster_name](variables.tf#L81) | Name of the primary cluster. | string | ✓ | |
-| [instance_name](variables.tf#L183) | Name of primary instance. | string | ✓ | |
-| [location](variables.tf#L195) | Region or zone of the cluster and instance. | string | ✓ | |
-| [network_config](variables.tf#L240) | Network configuration for cluster and instance. Only one between psa_config and psc_config can be used. | object({…}) | ✓ | |
-| [project_id](variables.tf#L275) | The ID of the project where this instances will be created. | string | ✓ | |
+| [initial_user](variables.tf#L174) | AlloyDB cluster initial user credentials. | object({…}) | ✓ | |
+| [instance_name](variables.tf#L182) | Name of primary instance. | string | ✓ | |
+| [location](variables.tf#L194) | Region or zone of the cluster and instance. | string | ✓ | |
+| [network_config](variables.tf#L239) | Network configuration for cluster and instance. Only one between psa_config and psc_config can be used. | object({…}) | ✓ | |
+| [project_id](variables.tf#L274) | 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#L58) | Availability type for the primary replica. Either `ZONAL` or `REGIONAL`. | string | | "REGIONAL" |
@@ -320,18 +347,17 @@ module "alloydb" {
| [encryption_config](variables.tf#L153) | Set encryption configuration. KMS name format: 'projects/[PROJECT]/locations/[REGION]/keyRings/[RING]/cryptoKeys/[KEY_NAME]'. | object({…}) | | null |
| [flags](variables.tf#L162) | Map FLAG_NAME=>VALUE for database-specific tuning. | map(string) | | null |
| [gce_zone](variables.tf#L168) | 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#L174) | AlloyDB cluster initial user credentials. | object({…}) | | null |
-| [labels](variables.tf#L189) | Labels to be attached to all instances. | map(string) | | null |
-| [machine_config](variables.tf#L201) | AlloyDB machine config. | object({…}) | | {} |
-| [maintenance_config](variables.tf#L215) | Set maintenance window configuration. | object({…}) | | {} |
-| [prefix](variables.tf#L265) | Optional prefix used to generate instance names. | string | | null |
-| [project_number](variables.tf#L280) | The project number of the project where this instances will be created. Only used for testing purposes. | string | | null |
-| [query_insights_config](variables.tf#L286) | Query insights config. | object({…}) | | {} |
-| [read_pool](variables.tf#L297) | Map of read pool instances to create in the primary cluster. | map(object({…})) | | {} |
-| [skip_await_major_version_upgrade](variables.tf#L342) | Set to true to skip awaiting on the major version upgrade of the cluster. | bool | | true |
-| [subscription_type](variables.tf#L348) | The subscription type of cluster. Possible values are: 'STANDARD' or 'TRIAL'. | string | | "STANDARD" |
-| [tag_bindings](variables.tf#L354) | Tag bindings for this service, in key => tag value id format. | map(string) | | {} |
-| [users](variables.tf#L361) | 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({…})) | | {} |
+| [labels](variables.tf#L188) | Labels to be attached to all instances. | map(string) | | null |
+| [machine_config](variables.tf#L200) | AlloyDB machine config. | object({…}) | | {} |
+| [maintenance_config](variables.tf#L214) | Set maintenance window configuration. | object({…}) | | {} |
+| [prefix](variables.tf#L264) | Optional prefix used to generate instance names. | string | | null |
+| [project_number](variables.tf#L279) | The project number of the project where this instances will be created. Only used for testing purposes. | string | | null |
+| [query_insights_config](variables.tf#L285) | Query insights config. | object({…}) | | {} |
+| [read_pool](variables.tf#L296) | Map of read pool instances to create in the primary cluster. | map(object({…})) | | {} |
+| [skip_await_major_version_upgrade](variables.tf#L341) | Set to true to skip awaiting on the major version upgrade of the cluster. | bool | | true |
+| [subscription_type](variables.tf#L347) | The subscription type of cluster. Possible values are: 'STANDARD' or 'TRIAL'. | string | | "STANDARD" |
+| [tag_bindings](variables.tf#L353) | Tag bindings for this service, in key => tag value id format. | map(string) | | {} |
+| [users](variables.tf#L360) | 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({…})) | | {} |
## Outputs
diff --git a/modules/alloydb/variables.tf b/modules/alloydb/variables.tf
index 3263e5c98..b180e0219 100644
--- a/modules/alloydb/variables.tf
+++ b/modules/alloydb/variables.tf
@@ -177,7 +177,6 @@ variable "initial_user" {
user = optional(string, "postgres")
password = string
})
- default = null
}
variable "instance_name" {
diff --git a/tests/modules/alloydb/examples/cmek.yaml b/tests/modules/alloydb/examples/cmek.yaml
index 9df488d9e..0aa96e348 100644
--- a/tests/modules/alloydb/examples/cmek.yaml
+++ b/tests/modules/alloydb/examples/cmek.yaml
@@ -24,7 +24,9 @@ values:
deletion_policy: DEFAULT
display_name: primary
etag: null
- initial_user: []
+ initial_user:
+ - password: changeit
+ user: postgres
labels: null
location: europe-west8
maintenance_update_policy: []
diff --git a/tests/modules/alloydb/examples/cross_region_replication.yaml b/tests/modules/alloydb/examples/cross_region_replication.yaml
index 19aef1f99..b228f376a 100644
--- a/tests/modules/alloydb/examples/cross_region_replication.yaml
+++ b/tests/modules/alloydb/examples/cross_region_replication.yaml
@@ -26,7 +26,9 @@ values:
display_name: db
encryption_config: []
etag: null
- initial_user: []
+ initial_user:
+ - password: changeit
+ user: postgres
labels: null
location: europe-west8
maintenance_update_policy: []
diff --git a/tests/modules/alloydb/examples/custom.yaml b/tests/modules/alloydb/examples/custom.yaml
index 53ac5f6d6..b882f18c3 100644
--- a/tests/modules/alloydb/examples/custom.yaml
+++ b/tests/modules/alloydb/examples/custom.yaml
@@ -26,7 +26,9 @@ values:
display_name: primary
encryption_config: []
etag: null
- initial_user: []
+ initial_user:
+ - password: changeit
+ user: postgres
labels: null
location: europe-west8
maintenance_update_policy: []
diff --git a/tests/modules/alloydb/examples/psc.yaml b/tests/modules/alloydb/examples/psc.yaml
index 988323e04..3b4e426b2 100644
--- a/tests/modules/alloydb/examples/psc.yaml
+++ b/tests/modules/alloydb/examples/psc.yaml
@@ -27,7 +27,9 @@ values:
display_name: db
encryption_config: []
etag: null
- initial_user: []
+ initial_user:
+ - password: changeit
+ user: postgres
labels: null
location: europe-west8
maintenance_update_policy: []
diff --git a/tests/modules/alloydb/examples/read_pool.yaml b/tests/modules/alloydb/examples/read_pool.yaml
index 76b9f8580..cd4b7aebd 100644
--- a/tests/modules/alloydb/examples/read_pool.yaml
+++ b/tests/modules/alloydb/examples/read_pool.yaml
@@ -26,7 +26,9 @@ values:
display_name: db
encryption_config: []
etag: null
- initial_user: []
+ initial_user:
+ - password: changeit
+ user: postgres
labels: null
location: europe-west8
maintenance_update_policy: []
diff --git a/tests/modules/alloydb/examples/simple.yaml b/tests/modules/alloydb/examples/simple.yaml
index 3add09656..e7113b1dd 100644
--- a/tests/modules/alloydb/examples/simple.yaml
+++ b/tests/modules/alloydb/examples/simple.yaml
@@ -26,7 +26,9 @@ values:
display_name: db
encryption_config: []
etag: null
- initial_user: []
+ initial_user:
+ - password: changeit
+ user: postgres
labels: null
location: europe-west8
maintenance_update_policy: []