Skip to content

Commit 4cdb81c

Browse files
zculek-fbg-awmalikapeabody
authored
feat: add deletion_protection.enabled for read replicas (#437)
Co-authored-by: g-awmalik <[email protected]> Co-authored-by: Andrew Peabody <[email protected]> Co-authored-by: Awais Malik <[email protected]>
1 parent ce3446a commit 4cdb81c

File tree

18 files changed

+63
-205
lines changed

18 files changed

+63
-205
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ docker_test_lint:
7676
.PHONY: docker_generate_docs
7777
docker_generate_docs:
7878
docker run --rm -it \
79+
-e ENABLE_BPMETADATA \
7980
-v "$(CURDIR)":/workspace \
8081
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
8182
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs'

metadata.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ spec:
2323
source:
2424
repo: https://github.com/terraform-google-modules/terraform-google-sql-db
2525
sourceType: git
26+
description: {}
2627
subBlueprints:
2728
- name: backup
2829
location: modules/backup

modules/backup/metadata.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ spec:
2626
actuationTool:
2727
type: Terraform
2828
version: '>= 0.13'
29+
description: {}
2930
examples:
3031
- name: mssql-public
3132
location: examples/mssql-public
@@ -50,37 +51,30 @@ spec:
5051
description: The number of days backups should be kept
5152
type: number
5253
default: 30
53-
required: false
5454
- name: backup_schedule
5555
description: The cron schedule to execute the internal backup
5656
type: string
5757
default: 45 2 * * *
58-
required: false
5958
- name: compress_export
6059
description: Whether or not to compress the export when storing in the bucket; Only valid for MySQL and PostgreSQL
6160
type: bool
6261
default: true
63-
required: false
6462
- name: enable_export_backup
6563
description: Weather to create exports to GCS Buckets with this module
6664
type: bool
6765
default: true
68-
required: false
6966
- name: enable_internal_backup
7067
description: Wether to create internal backups with this module
7168
type: bool
7269
default: true
73-
required: false
7470
- name: export_databases
7571
description: The list of databases that should be exported - if is an empty set all databases will be exported
7672
type: set(string)
7773
default: []
78-
required: false
7974
- name: export_schedule
8075
description: The cron schedule to execute the export to GCS
8176
type: string
8277
default: 15 3 * * *
83-
required: false
8478
- name: export_uri
8579
description: The bucket and path uri for exporting to GCS
8680
type: string
@@ -93,16 +87,13 @@ spec:
9387
description: The region where to run the workflow
9488
type: string
9589
default: us-central1
96-
required: false
9790
- name: scheduler_timezone
9891
description: The Timezone in which the Scheduler Jobs are triggered
9992
type: string
10093
default: Etc/GMT
101-
required: false
10294
- name: service_account
10395
description: The service account to use for running the workflow and triggering the workflow by Cloud Scheduler - If empty or null a service account will be created. If you have provided a service account you need to grant the Cloud SQL Admin and the Workflows Invoker role to that
10496
type: string
105-
required: false
10697
- name: sql_instance
10798
description: The name of the SQL instance to backup
10899
type: string
@@ -111,7 +102,6 @@ spec:
111102
description: Unique suffix to add to scheduler jobs and workflows names.
112103
type: string
113104
default: ""
114-
required: false
115105
outputs:
116106
- name: backup_workflow_name
117107
description: The name for internal backup workflow

modules/mssql/metadata.yaml

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ spec:
2727
actuationTool:
2828
type: Terraform
2929
version: '>= 0.13'
30+
description: {}
3031
examples:
3132
- name: mssql-public
3233
location: examples/mssql-public
@@ -51,12 +52,10 @@ spec:
5152
description: The activation policy for the master instance.Can be either `ALWAYS`, `NEVER` or `ON_DEMAND`.
5253
type: string
5354
default: ALWAYS
54-
required: false
5555
- name: active_directory_config
5656
description: Active domain that the SQL instance will join.
5757
type: map(string)
5858
default: {}
59-
required: false
6059
- name: additional_databases
6160
description: A list of databases to be created in your cluster
6261
type: |-
@@ -66,7 +65,6 @@ spec:
6665
collation = string
6766
}))
6867
default: []
69-
required: false
7068
- name: additional_users
7169
description: A list of users to be created in your cluster. A random password would be set for the user if the `random_password` variable is set.
7270
type: |-
@@ -76,12 +74,10 @@ spec:
7674
random_password = bool
7775
}))
7876
default: []
79-
required: false
8077
- name: availability_type
8178
description: The availability type for the master instance.This is only used to set up high availability for the MSSQL instance. Can be either `ZONAL` or `REGIONAL`.
8279
type: string
8380
default: ZONAL
84-
required: false
8581
- name: backup_configuration
8682
description: The database backup configuration.
8783
type: |-
@@ -102,12 +98,10 @@ spec:
10298
retention_unit: null
10399
start_time: null
104100
transaction_log_retention_days: null
105-
required: false
106101
- name: create_timeout
107102
description: The optional timeout that is applied to limit long database creates.
108103
type: string
109104
default: 30m
110-
required: false
111105
- name: database_flags
112106
description: The database flags for the master instance. See [more details](https://cloud.google.com/sql/docs/sqlserver/flags)
113107
type: |-
@@ -116,42 +110,34 @@ spec:
116110
value = string
117111
}))
118112
default: []
119-
required: false
120113
- name: database_version
121114
description: 'The database version to use: SQLSERVER_2017_STANDARD, SQLSERVER_2017_ENTERPRISE, SQLSERVER_2017_EXPRESS, or SQLSERVER_2017_WEB'
122115
type: string
123116
default: SQLSERVER_2017_STANDARD
124-
required: false
125117
- name: db_charset
126118
description: The charset for the default database
127119
type: string
128120
default: ""
129-
required: false
130121
- name: db_collation
131122
description: 'The collation for the default database. Example: ''en_US.UTF8'''
132123
type: string
133124
default: ""
134-
required: false
135125
- name: db_name
136126
description: The name of the default database to create
137127
type: string
138128
default: default
139-
required: false
140129
- name: delete_timeout
141130
description: The optional timeout that is applied to limit long database deletes.
142131
type: string
143132
default: 30m
144-
required: false
145133
- name: deletion_protection
146134
description: Used to block Terraform from deleting a SQL Instance.
147135
type: bool
148136
default: true
149-
required: false
150137
- name: deletion_protection_enabled
151138
description: Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform).
152139
type: bool
153140
default: false
154-
required: false
155141
- name: deny_maintenance_period
156142
description: The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. See [more details](https://cloud.google.com/sql/docs/sqlserver/maintenance)
157143
type: |-
@@ -161,35 +147,28 @@ spec:
161147
time = string
162148
}))
163149
default: []
164-
required: false
165150
- name: disk_autoresize
166151
description: Configuration to increase storage size.
167152
type: bool
168153
default: true
169-
required: false
170154
- name: disk_autoresize_limit
171155
description: The maximum size to which storage can be auto increased.
172156
type: number
173157
default: 0
174-
required: false
175158
- name: disk_size
176159
description: The disk size for the master instance.
177160
type: number
178161
default: 10
179-
required: false
180162
- name: disk_type
181163
description: The disk type for the master instance.
182164
type: string
183165
default: PD_SSD
184-
required: false
185166
- name: encryption_key_name
186167
description: The full path to the encryption key used for the CMEK disk encryption
187168
type: string
188-
required: false
189169
- name: follow_gae_application
190170
description: A Google App Engine application whose zone to remain in. Must be in the same region as this instance.
191171
type: string
192-
required: false
193172
- name: ip_configuration
194173
description: The ip configuration for the master instances.
195174
type: |-
@@ -206,27 +185,22 @@ spec:
206185
ipv4_enabled: true
207186
private_network: null
208187
require_ssl: null
209-
required: false
210188
- name: maintenance_window_day
211189
description: The day of week (1-7) for the master instance maintenance.
212190
type: number
213191
default: 1
214-
required: false
215192
- name: maintenance_window_hour
216193
description: The hour of day (0-23) maintenance window for the master instance maintenance.
217194
type: number
218195
default: 23
219-
required: false
220196
- name: maintenance_window_update_track
221197
description: The update track of maintenance window for the master instance maintenance.Can be either `canary` or `stable`.
222198
type: string
223199
default: canary
224-
required: false
225200
- name: module_depends_on
226201
description: List of modules or resources this module depends on.
227202
type: list(any)
228203
default: []
229-
required: false
230204
- name: name
231205
description: The name of the Cloud SQL resources
232206
type: string
@@ -235,7 +209,6 @@ spec:
235209
description: The pricing plan for the master instance.
236210
type: string
237211
default: PER_USE
238-
required: false
239212
- name: project_id
240213
description: The project ID to manage the Cloud SQL resources
241214
type: string
@@ -244,56 +217,45 @@ spec:
244217
description: Sets random suffix at the end of the Cloud SQL resource name
245218
type: bool
246219
default: false
247-
required: false
248220
- name: region
249221
description: The region of the Cloud SQL resources
250222
type: string
251223
default: us-central1
252-
required: false
253224
- name: root_password
254225
description: MSSERVER password for the root user. If not set, a random one will be generated and available in the root_password output variable.
255226
type: string
256227
default: ""
257-
required: false
258228
- name: secondary_zone
259229
description: 'The preferred zone for the secondary/failover instance, it should be something like: `us-central1-a`, `us-east1-c`.'
260230
type: string
261-
required: false
262231
- name: sql_server_audit_config
263232
description: SQL server audit config settings.
264233
type: map(string)
265234
default: {}
266-
required: false
267235
- name: tier
268236
description: The tier for the master instance.
269237
type: string
270238
default: db-custom-2-3840
271-
required: false
272239
- name: update_timeout
273240
description: The optional timeout that is applied to limit long database updates.
274241
type: string
275242
default: 30m
276-
required: false
277243
- name: user_labels
278244
description: The key/value labels for the master instances.
279245
type: map(string)
280246
default: {}
281-
required: false
282247
- name: user_name
283248
description: The name of the default user
284249
type: string
285250
default: default
286-
required: false
287251
- name: user_password
288252
description: The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable.
289253
type: string
290254
default: ""
291-
required: false
292255
- name: zone
293256
description: The zone for the master instance.
294257
type: string
295258
default: us-central1-a
296-
required: false
297259
outputs:
298260
- name: additional_users
299261
description: List of maps of additional users and passwords

modules/mysql/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
2121
| db\_name | The name of the default database to create | `string` | `"default"` | no |
2222
| delete\_timeout | The optional timout that is applied to limit long database deletes. | `string` | `"30m"` | no |
2323
| deletion\_protection | Used to block Terraform from deleting a SQL Instance. | `bool` | `true` | no |
24-
| deletion\_protection\_enabled | Enables protection of an instance from accidental deletion protection across all surfaces (API, gcloud, Cloud Console and Terraform). | `bool` | `false` | no |
24+
| deletion\_protection\_enabled | Enables protection of an instance from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). | `bool` | `false` | no |
2525
| deny\_maintenance\_period | The Deny Maintenance Period fields to prevent automatic maintenance from occurring during a 90-day time period. See [more details](https://cloud.google.com/sql/docs/mysql/maintenance) | <pre>list(object({<br> end_date = string<br> start_date = string<br> time = string<br> }))</pre> | `[]` | no |
2626
| disk\_autoresize | Configuration to increase storage size | `bool` | `true` | no |
2727
| disk\_autoresize\_limit | The maximum size to which storage can be auto increased. | `number` | `0` | no |
@@ -44,6 +44,7 @@ Note: CloudSQL provides [disk autoresize](https://cloud.google.com/sql/docs/mysq
4444
| project\_id | The project ID to manage the Cloud SQL resources | `string` | n/a | yes |
4545
| random\_instance\_name | Sets random suffix at the end of the Cloud SQL resource name | `bool` | `false` | no |
4646
| read\_replica\_deletion\_protection | Used to block Terraform from deleting replica SQL Instances. | `bool` | `false` | no |
47+
| read\_replica\_deletion\_protection\_enabled | Enables protection of a read replica from accidental deletion across all surfaces (API, gcloud, Cloud Console and Terraform). | `bool` | `false` | no |
4748
| read\_replica\_name\_suffix | The optional suffix to add to the read instance name | `string` | `""` | no |
4849
| read\_replicas | List of read replicas to create. Encryption key is required for replica in different region. For replica in same region as master set encryption\_key\_name = null | <pre>list(object({<br> name = string<br> name_override = optional(string)<br> tier = string<br> zone = string<br> availability_type = string<br> disk_type = string<br> disk_autoresize = bool<br> disk_autoresize_limit = number<br> disk_size = string<br> user_labels = map(string)<br> database_flags = list(object({<br> name = string<br> value = string<br> }))<br> ip_configuration = object({<br> authorized_networks = list(map(string))<br> ipv4_enabled = bool<br> private_network = string<br> require_ssl = bool<br> allocated_ip_range = string<br> })<br> encryption_key_name = string<br> }))</pre> | `[]` | no |
4950
| region | The region of the Cloud SQL resources | `string` | `"us-central1"` | no |

0 commit comments

Comments
 (0)