diff --git a/examples/cloudsql/database-instance.gyro b/examples/cloudsql/database-instance.gyro index d8a62629..3ad3ed73 100644 --- a/examples/cloudsql/database-instance.gyro +++ b/examples/cloudsql/database-instance.gyro @@ -38,6 +38,7 @@ google::database-instance database-instance-example ipv4-enabled: true server-ca-mode: 'GOOGLE_MANAGED_INTERNAL_CA' ssl-mode: 'ALLOW_UNENCRYPTED_AND_ENCRYPTED' + private-network: $(external-query google::compute-network { name: "test-db" }) authorized-networks name: "example-QA-enviroment" @@ -49,6 +50,14 @@ google::database-instance database-instance-example zone: 'us-central1-c' secondary-zone: 'us-central1-b' end + + password-validation-policy + complexity: "COMPLEXITY_DEFAULT" + disallow-username-substring: true + enable-password-policy: true + min-length: 8 + reuse-interval: 1 + end end database-version: "MYSQL_8_0_31" @@ -57,6 +66,12 @@ google::database-instance database-instance-example instance-type: "CLOUD_SQL_INSTANCE" region: "us-central1" backend-type: "SECOND_GEN" + + scheduled-maintenance + can-reschedule: true + schedule-deadline-time: "2025-02-31T23:59:59.00Z" + start-time: "2024-12-31T23:59:59.00Z" + end end google::database-instance database-instance-example-replica diff --git a/src/main/java/gyro/google/cloudsql/DatabaseInstanceResource.java b/src/main/java/gyro/google/cloudsql/DatabaseInstanceResource.java index d2d18832..0378ff06 100644 --- a/src/main/java/gyro/google/cloudsql/DatabaseInstanceResource.java +++ b/src/main/java/gyro/google/cloudsql/DatabaseInstanceResource.java @@ -94,6 +94,7 @@ * ipv4-enabled: true * server-ca-mode: 'GOOGLE_MANAGED_INTERNAL_CA' * ssl-mode: 'ALLOW_UNENCRYPTED_AND_ENCRYPTED' + * private-network: $(external-query google::compute-network { name: "test-db" }) * * authorized-networks * name: "example-QA-enviroment" @@ -105,6 +106,14 @@ * zone: 'us-central1-c' * secondary-zone: 'us-central1-b' * end + * + * password-validation-policy + * complexity: "COMPLEXITY_DEFAULT" + * disallow-username-substring: true + * enable-password-policy: true + * min-length: 8 + * reuse-interval: 1 + * end * end * * database-version: "MYSQL_8_0_31" @@ -113,6 +122,12 @@ * instance-type: "CLOUD_SQL_INSTANCE" * region: "us-central1" * backend-type: "SECOND_GEN" + * + * scheduled-maintenance + * can-reschedule: true + * schedule-deadline-time: "2025-02-31T23:59:59.00Z" + * start-time: "2024-12-31T23:59:59.00Z" + * end * end * * google::database-instance database-instance-example-replica @@ -788,7 +803,7 @@ public void copyFrom(DatabaseInstance model) throws Exception { setMasterInstance(null); if (model.getMasterInstanceName() != null) { - setMasterInstance(findById(DatabaseInstanceResource.class, model.getMasterInstanceName())); + setMasterInstance(findById(DatabaseInstanceResource.class, model.getMasterInstanceName().split(":")[1])); } setOnPremisesConfiguration(null);