Skip to content

Commit 3d2feea

Browse files
authored
Merge pull request #102 from sparkfabrik/feature/postgresql_database_flags
feat: Add support for database flags in Cloud SQL instance configuration
2 parents 59648d9 + b8d7947 commit 3d2feea

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ Then perform the following commands on the root folder:
154154
| postgresql\_availability\_type | The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL). | `string` | `"REGIONAL"` | no |
155155
| postgresql\_backup\_retained\_count | Numeber of postgres backup to be retained. Default 30. | `number` | `"30"` | no |
156156
| postgresql\_backup\_start\_time | HH:MM format time indicating when postgres backup configuration starts. | `string` | `"02:00"` | no |
157+
| postgresql\_database\_flags | List of database flags for Cloud SQL instance. Each item must be an object with 'name' and 'value'. | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
157158
| postgresql\_db\_random\_suffix | Sets random suffix at the end of the Cloud SQL instance name. | `bool` | `false` | no |
158159
| postgresql\_del\_protection | Whether or not to allow Terraform to destroy the instance. Unless this field is set to false in Terraform state, a terraform destroy or terraform apply command that deletes the instance will fail. | `bool` | `true` | no |
159160
| postgresql\_disk\_size | he size of data disk, in GB. Size of a running instance cannot be reduced but can be increased. Default to 100 GB | `number` | `"100"` | no |
@@ -179,6 +180,8 @@ Then perform the following commands on the root folder:
179180
| created\_bucket\_names | The list of the created buckets. |
180181
| gitlab\_address | IP address where you can connect to your GitLab instance |
181182
| gitlab\_namespace | The namespace where Gitlab is installed. |
183+
| gitlab\_network\_selflink | The self link of the network used by the GKE cluster. |
184+
| gitlab\_subnet\_selflink | The self link of the subnet used by the GKE cluster. |
182185
| gitlab\_url | URL where you can access your GitLab instance |
183186
| gke\_service\_account | The service account used by the GKE cluster. |
184187
| root\_password\_instructions | Instructions for getting the root user's password for initial setup |

main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,14 @@ resource "google_sql_database_instance" "gitlab_db" {
209209
require_ssl = "true"
210210
}
211211

212+
dynamic "database_flags" {
213+
for_each = var.postgresql_database_flags
214+
content {
215+
name = lookup(database_flags.value, "name", null)
216+
value = lookup(database_flags.value, "value", null)
217+
}
218+
}
219+
212220
insights_config {
213221
query_insights_enabled = false
214222
}

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ variable "postgresql_db_random_suffix" {
9999
default = false
100100
}
101101

102+
# Allow passing 0..N database flags (name/value pairs) for Cloud SQL instance
103+
variable "postgresql_database_flags" {
104+
type = list(object({
105+
name = string
106+
value = string
107+
}))
108+
description = "List of database flags for Cloud SQL instance. Each item must be an object with 'name' and 'value'."
109+
default = []
110+
}
111+
102112
####################
103113
# REDIS SECTION #
104114
####################

0 commit comments

Comments
 (0)