Skip to content

Commit

Permalink
Fix examples
Browse files Browse the repository at this point in the history
  • Loading branch information
harjain99 committed Sep 25, 2024
1 parent ff533c7 commit e14c52e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
15 changes: 15 additions & 0 deletions examples/cloudsql/database-instance.gyro
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down
17 changes: 16 additions & 1 deletion src/main/java/gyro/google/cloudsql/DatabaseInstanceResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e14c52e

Please sign in to comment.