Skip to content

Commit 599ac6b

Browse files
authored
Merge pull request #28 from geojaz/fix_timeouts
Exposes timeout parameters
2 parents 3ed8c60 + ce7f68b commit 599ac6b

File tree

9 files changed

+206
-140
lines changed

9 files changed

+206
-140
lines changed

modules/mysql/README.md

Lines changed: 84 additions & 81 deletions
Large diffs are not rendered by default.

modules/mysql/failover_replica.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@ resource "google_sql_database_instance" "failover-replica" {
5454
lifecycle {
5555
ignore_changes = ["disk_size"]
5656
}
57+
58+
timeouts {
59+
create = "${var.create_timeout}"
60+
update = "${var.update_timeout}"
61+
delete = "${var.delete_timeout}"
62+
}
5763
}

modules/mysql/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ resource "google_sql_database_instance" "default" {
5959
lifecycle {
6060
ignore_changes = ["disk_size"]
6161
}
62+
63+
timeouts {
64+
create = "${var.create_timeout}"
65+
update = "${var.update_timeout}"
66+
delete = "${var.delete_timeout}"
67+
}
6268
}
6369

6470
resource "google_sql_database" "default" {

modules/mysql/read_replica.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,10 @@ resource "google_sql_database_instance" "replicas" {
6969
lifecycle {
7070
ignore_changes = ["disk_size"]
7171
}
72+
73+
timeouts {
74+
create = "${var.create_timeout}"
75+
update = "${var.update_timeout}"
76+
delete = "${var.delete_timeout}"
77+
}
7278
}

modules/mysql/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,18 @@ variable "additional_users" {
327327
description = "A list of users to be created in your cluster"
328328
default = []
329329
}
330+
331+
variable create_timeout {
332+
description = "The optional timout that is applied to limit long database creates."
333+
default = "10m"
334+
}
335+
336+
variable update_timeout {
337+
description = "The optional timout that is applied to limit long database updates."
338+
default = "10m"
339+
}
340+
341+
variable delete_timeout {
342+
description = "The optional timout that is applied to limit long database deletes."
343+
default = "10m"
344+
}

modules/postgresql/README.md

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,72 @@
66

77
| Name | Description | Type | Default | Required |
88
|------|-------------|:----:|:-----:|:-----:|
9-
| activation_policy | The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. | string | `ALWAYS` | no |
10-
| additional_databases | A list of databases to be created in your cluster | list | `<list>` | no |
11-
| additional_users | A list of users to be created in your cluster | list | `<list>` | no |
12-
| authorized_gae_applications | The authorized gae applications for the Cloud SQL instances | list | `<list>` | no |
13-
| availability_type | The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`. | string | `ZONAL` | no |
14-
| backup_configuration | The backup configuration block of the Cloud SQL resources This argument will be passed through the master instance directrly.<br><br>See [more details](https://www.terraform.io/docs/providers/google/r/sql_database_instance.html). | map | `<map>` | no |
15-
| database_flags | The database flags for the master instance. See [more details](https://cloud.google.com/sql/docs/mysql/flags) | list | `<list>` | no |
16-
| database_version | The database version to use | string | - | yes |
17-
| db_charset | The charset for the default database | string | `` | no |
18-
| db_collation | The collation for the default database. Example: 'en_US.UTF8' | string | `` | no |
19-
| db_name | The name of the default database to create | string | `default` | no |
20-
| disk_autoresize | Configuration to increase storage size. | string | `true` | no |
21-
| disk_size | The disk size for the master instance. | string | `10` | no |
22-
| disk_type | The disk type for the master instance. | string | `PD_SSD` | no |
23-
| ip_configuration | The ip configuration for the master instances. | map | `<map>` | no |
24-
| maintenance_window_day | The day of week (1-7) for the master instance maintenance. | string | `1` | no |
25-
| maintenance_window_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | string | `23` | no |
26-
| maintenance_window_update_track | The update track of maintenance window for the master instance maintenance.Can be either `canary` or `stable`. | string | `canary` | no |
27-
| name | The name of the Cloud SQL resources | string | - | yes |
28-
| pricing_plan | The pricing plan for the master instance. | string | `PER_USE` | no |
29-
| project_id | The project ID to manage the Cloud SQL resources | string | - | yes |
30-
| read_replica_activation_policy | The activation policy for the read replica instances.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. | string | `ALWAYS` | no |
31-
| read_replica_availability_type | The availability type for the read replica instances.This is only used to set up high availability for the PostgreSQL instances. Can be either `ZONAL` or `REGIONAL`. | string | `ZONAL` | no |
32-
| read_replica_configuration | The replica configuration for use in read replica | map | `<map>` | no |
33-
| read_replica_crash_safe_replication | The crash safe replication is to indicates when crash-safe replication flags are enabled. | string | `true` | no |
34-
| read_replica_database_flags | The database flags for the read replica instances. See [more details](https://cloud.google.com/sql/docs/mysql/flags) | list | `<list>` | no |
35-
| read_replica_disk_autoresize | Configuration to increase storage size. | string | `true` | no |
36-
| read_replica_disk_size | The disk size for the read replica instances. | string | `10` | no |
37-
| read_replica_disk_type | The disk type for the read replica instances. | string | `PD_SSD` | no |
38-
| read_replica_ip_configuration | The ip configuration for the read instances. | map | `<map>` | no |
39-
| read_replica_maintenance_window_day | The day of week (1-7) for the read replica instances maintenance. | string | `1` | no |
40-
| read_replica_maintenance_window_hour | The hour of day (0-23) maintenance window for the read replica instances maintenance. | string | `23` | no |
41-
| read_replica_maintenance_window_update_track | The update track of maintenance window for the read replica instances maintenance.Can be either `canary` or `stable`. | string | `canary` | no |
42-
| read_replica_pricing_plan | The pricing plan for the read replica instances. | string | `PER_USE` | no |
43-
| read_replica_replication_type | The replication type for read replica instances. Can be one of ASYNCHRONOUS or SYNCHRONOUS. | string | `SYNCHRONOUS` | no |
44-
| read_replica_size | The size of read replicas | string | `0` | no |
45-
| read_replica_tier | The tier for the read replica instances. | string | `` | no |
46-
| read_replica_user_labels | The key/value labels for the read replica instances. | map | `<map>` | no |
47-
| read_replica_zones | The zones for the read replica instancess, it should be something like: `a,b,c`. Given zones are used rotationally for creating read replicas. | string | `` | no |
48-
| region | The region of the Cloud SQL resources | string | `us-central1` | no |
49-
| tier | The tier for the master instance. | string | `db-f1-micro` | no |
50-
| user_labels | The key/value labels for the master instances. | map | `<map>` | no |
51-
| user_name | The name of the default user | string | `default` | no |
52-
| user_password | The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. | string | `` | no |
53-
| zone | The zone for the master instance, it should be something like: `a`, `c`. | string | - | yes |
9+
| activation\_policy | The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. | string | `"ALWAYS"` | no |
10+
| additional\_databases | A list of databases to be created in your cluster | list | `<list>` | no |
11+
| additional\_users | A list of users to be created in your cluster | list | `<list>` | no |
12+
| authorized\_gae\_applications | The authorized gae applications for the Cloud SQL instances | list | `<list>` | no |
13+
| availability\_type | The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`. | string | `"ZONAL"` | no |
14+
| backup\_configuration | The backup configuration block of the Cloud SQL resources This argument will be passed through the master instance directrly.<br><br>See [more details](https://www.terraform.io/docs/providers/google/r/sql_database_instance.html). | map | `<map>` | no |
15+
| create\_timeout | The optional timout that is applied to limit long database creates. | string | `"10m"` | no |
16+
| database\_flags | The database flags for the master instance. See [more details](https://cloud.google.com/sql/docs/mysql/flags) | list | `<list>` | no |
17+
| database\_version | The database version to use | string | n/a | yes |
18+
| db\_charset | The charset for the default database | string | `""` | no |
19+
| db\_collation | The collation for the default database. Example: 'en_US.UTF8' | string | `""` | no |
20+
| db\_name | The name of the default database to create | string | `"default"` | no |
21+
| delete\_timeout | The optional timout that is applied to limit long database deletes. | string | `"10m"` | no |
22+
| disk\_autoresize | Configuration to increase storage size. | string | `"true"` | no |
23+
| disk\_size | The disk size for the master instance. | string | `"10"` | no |
24+
| disk\_type | The disk type for the master instance. | string | `"PD_SSD"` | no |
25+
| ip\_configuration | The ip configuration for the master instances. | map | `<map>` | no |
26+
| maintenance\_window\_day | The day of week (1-7) for the master instance maintenance. | string | `"1"` | no |
27+
| maintenance\_window\_hour | The hour of day (0-23) maintenance window for the master instance maintenance. | string | `"23"` | no |
28+
| maintenance\_window\_update\_track | The update track of maintenance window for the master instance maintenance.Can be either `canary` or `stable`. | string | `"canary"` | no |
29+
| name | The name of the Cloud SQL resources | string | n/a | yes |
30+
| pricing\_plan | The pricing plan for the master instance. | string | `"PER_USE"` | no |
31+
| project\_id | The project ID to manage the Cloud SQL resources | string | n/a | yes |
32+
| read\_replica\_activation\_policy | The activation policy for the read replica instances.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`. | string | `"ALWAYS"` | no |
33+
| read\_replica\_availability\_type | The availability type for the read replica instances.This is only used to set up high availability for the PostgreSQL instances. Can be either `ZONAL` or `REGIONAL`. | string | `"ZONAL"` | no |
34+
| read\_replica\_configuration | The replica configuration for use in read replica | map | `<map>` | no |
35+
| read\_replica\_crash\_safe\_replication | The crash safe replication is to indicates when crash-safe replication flags are enabled. | string | `"true"` | no |
36+
| read\_replica\_database\_flags | The database flags for the read replica instances. See [more details](https://cloud.google.com/sql/docs/mysql/flags) | list | `<list>` | no |
37+
| read\_replica\_disk\_autoresize | Configuration to increase storage size. | string | `"true"` | no |
38+
| read\_replica\_disk\_size | The disk size for the read replica instances. | string | `"10"` | no |
39+
| read\_replica\_disk\_type | The disk type for the read replica instances. | string | `"PD_SSD"` | no |
40+
| read\_replica\_ip\_configuration | The ip configuration for the read instances. | map | `<map>` | no |
41+
| read\_replica\_maintenance\_window\_day | The day of week (1-7) for the read replica instances maintenance. | string | `"1"` | no |
42+
| read\_replica\_maintenance\_window\_hour | The hour of day (0-23) maintenance window for the read replica instances maintenance. | string | `"23"` | no |
43+
| read\_replica\_maintenance\_window\_update\_track | The update track of maintenance window for the read replica instances maintenance.Can be either `canary` or `stable`. | string | `"canary"` | no |
44+
| read\_replica\_pricing\_plan | The pricing plan for the read replica instances. | string | `"PER_USE"` | no |
45+
| read\_replica\_replication\_type | The replication type for read replica instances. Can be one of ASYNCHRONOUS or SYNCHRONOUS. | string | `"SYNCHRONOUS"` | no |
46+
| read\_replica\_size | The size of read replicas | string | `"0"` | no |
47+
| read\_replica\_tier | The tier for the read replica instances. | string | `""` | no |
48+
| read\_replica\_user\_labels | The key/value labels for the read replica instances. | map | `<map>` | no |
49+
| read\_replica\_zones | The zones for the read replica instancess, it should be something like: `a,b,c`. Given zones are used rotationally for creating read replicas. | string | `""` | no |
50+
| region | The region of the Cloud SQL resources | string | `"us-central1"` | no |
51+
| tier | The tier for the master instance. | string | `"db-f1-micro"` | no |
52+
| update\_timeout | The optional timout that is applied to limit long database updates. | string | `"10m"` | no |
53+
| user\_labels | The key/value labels for the master instances. | map | `<map>` | no |
54+
| user\_name | The name of the default user | string | `"default"` | no |
55+
| user\_password | The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable. | string | `""` | no |
56+
| zone | The zone for the master instance, it should be something like: `a`, `c`. | string | n/a | yes |
5457

5558
## Outputs
5659

5760
| Name | Description |
5861
|------|-------------|
59-
| generated_user_password | The auto generated default user password if not input password was provided |
60-
| instance_address | The IPv4 addesses assigned for the master instance |
61-
| instance_connection_name | The connection name of the master instance to be used in connection strings |
62-
| instance_first_ip_address | The first IPv4 address of the addresses assigned. |
63-
| instance_name | The instance name for the master instance |
64-
| instance_self_link | The URI of the master instance |
65-
| instance_server_ca_cert | The CA certificate information used to connect to the SQL instance via SSL |
66-
| instance_service_account_email_address | The service account email address assigned to the master instance |
67-
| read_replica_instance_names | The instance names for the read replica instances |
68-
| replicas_instance_connection_names | The connection names of the replica instances to be used in connection strings |
69-
| replicas_instance_ip_addresses | The IPv4 addresses assigned for the replica instances |
70-
| replicas_instance_self_links | The URIs of the replica instances |
71-
| replicas_instance_server_ca_certs | The CA certificates information used to connect to the replica instances via SSL |
72-
| replicas_instance_service_account_email_addresses | The service account email addresses assigned to the replica instances |
62+
| generated\_user\_password | The auto generated default user password if not input password was provided |
63+
| instance\_address | The IPv4 addesses assigned for the master instance |
64+
| instance\_connection\_name | The connection name of the master instance to be used in connection strings |
65+
| instance\_first\_ip\_address | The first IPv4 address of the addresses assigned. |
66+
| instance\_name | The instance name for the master instance |
67+
| instance\_self\_link | The URI of the master instance |
68+
| instance\_server\_ca\_cert | The CA certificate information used to connect to the SQL instance via SSL |
69+
| instance\_service\_account\_email\_address | The service account email address assigned to the master instance |
70+
| read\_replica\_instance\_names | The instance names for the read replica instances |
71+
| replicas\_instance\_connection\_names | The connection names of the replica instances to be used in connection strings |
72+
| replicas\_instance\_ip\_addresses | The IPv4 addresses assigned for the replica instances |
73+
| replicas\_instance\_self\_links | The URIs of the replica instances |
74+
| replicas\_instance\_server\_ca\_certs | The CA certificates information used to connect to the replica instances via SSL |
75+
| replicas\_instance\_service\_account\_email\_addresses | The service account email addresses assigned to the replica instances |
7376

7477
[^]: (autogen_docs_end)

modules/postgresql/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ resource "google_sql_database_instance" "default" {
5858
lifecycle {
5959
ignore_changes = ["disk_size"]
6060
}
61+
62+
timeouts {
63+
create = "${var.create_timeout}"
64+
update = "${var.update_timeout}"
65+
delete = "${var.delete_timeout}"
66+
}
6167
}
6268

6369
resource "google_sql_database" "default" {

modules/postgresql/read_replica.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,10 @@ resource "google_sql_database_instance" "replicas" {
7070
lifecycle {
7171
ignore_changes = ["disk_size"]
7272
}
73+
74+
timeouts {
75+
create = "${var.create_timeout}"
76+
update = "${var.update_timeout}"
77+
delete = "${var.delete_timeout}"
78+
}
7379
}

modules/postgresql/variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,18 @@ variable "additional_users" {
242242
description = "A list of users to be created in your cluster"
243243
default = []
244244
}
245+
246+
variable create_timeout {
247+
description = "The optional timout that is applied to limit long database creates."
248+
default = "10m"
249+
}
250+
251+
variable update_timeout {
252+
description = "The optional timout that is applied to limit long database updates."
253+
default = "10m"
254+
}
255+
256+
variable delete_timeout {
257+
description = "The optional timout that is applied to limit long database deletes."
258+
default = "10m"
259+
}

0 commit comments

Comments
 (0)