diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a072ac1..1193d33 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,7 +3,7 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-yaml - id: end-of-file-fixer @@ -11,7 +11,7 @@ repos: - id: check-symlinks - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.95.0 + rev: v1.96.3 hooks: - id: terraform_fmt @@ -29,7 +29,7 @@ repos: - id: terraform_docs - repo: https://github.com/bridgecrewio/checkov.git - rev: 3.2.254 + rev: 3.2.344 hooks: - id: checkov verbose: true diff --git a/README.md b/README.md index 8155e74..9584480 100644 --- a/README.md +++ b/README.md @@ -55,10 +55,6 @@ Links to documentation and other resources required to develop and iterate in th All tests are [mocked](https://developer.hashicorp.com/terraform/language/tests/mocking) allowing us to test the module without creating infrastructure or requiring credentials. The trade-offs are acceptable in favor of speed and simplicity. In a Terraform test, a mocked provider or resource will generate fake data for all computed attributes that would normally be provided by the underlying provider APIs. -```none -cd fixtures/default -``` - ```none terraform init ``` diff --git a/regional/README.md b/regional/README.md index 8436402..5a2ca4c 100644 --- a/regional/README.md +++ b/regional/README.md @@ -11,8 +11,8 @@ No requirements. | Name | Version | |------|---------| -| [google](#provider\_google) | 6.2.0 | -| [random](#provider\_random) | 3.6.3 | +| [google](#provider\_google) | 5.38.0 | +| [random](#provider\_random) | 3.6.2 | ## Modules @@ -33,7 +33,7 @@ No modules. | [availability\_type](#input\_availability\_type) | The availability type of the Cloud SQL instance | `string` | `"REGIONAL"` | no | | [backup\_start\_time](#input\_backup\_start\_time) | Time indicating when backup configuration starts | `string` | `"04:00"` | no | | [client\_certs](#input\_client\_certs) | A set of client cert names, note: 10 max per instance | `set(string)` | `[]` | no | -| [database\_version](#input\_database\_version) | The MySQL, PostgreSQL or SQL Server version to use. | `string` | `"POSTGRES_15"` | no | +| [database\_version](#input\_database\_version) | The MySQL, PostgreSQL or SQL Server version to use. | `string` | `"POSTGRES_16"` | no | | [deletion\_protection](#input\_deletion\_protection) | Whether or not to allow Terraform to destroy the instance | `bool` | `true` | no | | [host\_project\_id](#input\_host\_project\_id) | Host project ID for the shared VPC | `string` | `""` | no | | [instance\_name](#input\_instance\_name) | The name of the instance | `string` | n/a | yes | @@ -43,7 +43,7 @@ No modules. | [mw\_hour](#input\_mw\_hour) | Maintenance window hour | `number` | `17` | no | | [network](#input\_network) | The VPC network from which the Cloud SQL instance is accessible for private IP | `string` | n/a | yes | | [point\_in\_time\_recovery\_enabled](#input\_point\_in\_time\_recovery\_enabled) | True if Point-in-time recovery is enabled. Will restart database if enabled after instance creation. Valid only for PostgreSQL instances | `bool` | `false` | no | -| [postgres\_database\_flags](#input\_postgres\_database\_flags) | The database flags for Cloud SQL. See [PostgreSQL Flags](https://cloud.google.com/sql/docs/postgres/flags) |
list(object({
name = string
value = string
}))
| `[]` | no | +| [postgres\_database\_flags](#input\_postgres\_database\_flags) | The database flags for Cloud SQL. See [PostgreSQL Flags](https://cloud.google.com/sql/docs/postgres/flags) |
list(object({
name = string
value = string
}))
| `[]` | no | | [project](#input\_project) | The ID of the project in which the resource belongs | `string` | n/a | yes | | [query\_insights\_enabled](#input\_query\_insights\_enabled) | True if Query Insights feature is enabled | `bool` | `true` | no | | [query\_plans\_per\_minute](#input\_query\_plans\_per\_minute) | Number of query execution plans captured by Insights per minute for all queries combined. Between 0 and 20 | `number` | `5` | no | diff --git a/regional/locals.tf b/regional/locals.tf index 7e7ab69..7fa041c 100644 --- a/regional/locals.tf +++ b/regional/locals.tf @@ -2,6 +2,7 @@ # https://www.terraform.io/docs/language/values/locals.html locals { + name = "${var.instance_name}-${random_id.this.hex}-${var.region}" network = "projects/${var.host_project_id}/global/networks/${var.network}" # These flags are required for CIS GCP v1.3.0 compliance diff --git a/regional/main.tf b/regional/main.tf index abc06f6..e7a03b7 100644 --- a/regional/main.tf +++ b/regional/main.tf @@ -24,12 +24,13 @@ resource "google_sql_database_instance" "this" { database_version = var.database_version deletion_protection = var.deletion_protection - name = "${var.instance_name}-${random_id.this.hex}-${var.region}" + name = local.name project = var.project region = var.region settings { availability_type = var.availability_type + edition = "ENTERPRISE" tier = var.machine_tier backup_configuration { @@ -66,15 +67,8 @@ resource "google_sql_database_instance" "this" { update_track = var.update_track } - user_labels = var.labels } - - timeouts { - create = "60m" - delete = "60m" - update = "60m" - } } # Google SQL SSL Certificate Resource diff --git a/regional/variables.tf b/regional/variables.tf index 98ff649..0d63b0a 100644 --- a/regional/variables.tf +++ b/regional/variables.tf @@ -22,7 +22,7 @@ variable "client_certs" { variable "database_version" { description = "The MySQL, PostgreSQL or SQL Server version to use." type = string - default = "POSTGRES_15" + default = "POSTGRES_16" } variable "deletion_protection" {