Skip to content

Commit

Permalink
expose database collation setting as tf variable (#1114)
Browse files Browse the repository at this point in the history
* expose database collation setting as tf variable

Signed-off-by: Bob Callaway <[email protected]>

* add to sigstore module too

Signed-off-by: Bob Callaway <[email protected]>

---------

Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway authored May 23, 2024
1 parent c9e0d45 commit 4fdf325
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion terraform/gcp/modules/mysql-shard/mysql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ resource "google_sql_database" "trillian" {
name = var.db_name
project = var.project_id
instance = google_sql_database_instance.trillian.name
collation = "utf8_general_ci"
collation = var.collation
depends_on = [google_sql_database_instance.trillian]
}

Expand Down
6 changes: 6 additions & 0 deletions terraform/gcp/modules/mysql-shard/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,9 @@ variable "password" {
description = "mysql password within the database"
sensitive = true
}

variable "collation" {
type = string
description = "collation setting for database"
default = "utf8_general_ci"
}
4 changes: 2 additions & 2 deletions terraform/gcp/modules/mysql/mysql.tf
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ resource "google_sql_database" "trillian" {
name = var.db_name
project = var.project_id
instance = google_sql_database_instance.sigstore.name
collation = "utf8_general_ci"
collation = var.collation
depends_on = [google_sql_database_instance.sigstore]
}

resource "google_sql_database" "searchindexes" {
name = var.index_db_name
project = var.project_id
instance = google_sql_database_instance.sigstore.name
collation = "utf8_general_ci"
collation = var.collation
depends_on = [google_sql_database_instance.sigstore]
}

Expand Down
6 changes: 6 additions & 0 deletions terraform/gcp/modules/mysql/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ variable "deletion_protection" {
description = "Deletion protection for MYSQL database. Must be set to false for `terraform apply` or `terraform destroy` to delete the db."
default = true
}

variable "collation" {
type = string
description = "collation setting for database"
default = "utf8_general_ci"
}
3 changes: 3 additions & 0 deletions terraform/gcp/modules/sigstore/sigstore.tf
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ module "mysql" {
database_version = var.mysql_db_version
tier = var.mysql_tier
availability_type = var.mysql_availability_type
collation = var.mysql_collation

replica_zones = var.mysql_replica_zones
replica_tier = var.mysql_replica_tier
Expand Down Expand Up @@ -373,6 +374,7 @@ module "ctlog_shards" {
require_ssl = var.mysql_require_ssl
backup_enabled = var.mysql_backup_enabled
binary_log_backup_enabled = var.mysql_binary_log_backup_enabled
collation = var.mysql_collation


depends_on = [
Expand Down Expand Up @@ -423,6 +425,7 @@ module "standalone_mysqls" {
require_ssl = var.mysql_require_ssl
backup_enabled = var.mysql_backup_enabled
binary_log_backup_enabled = var.mysql_binary_log_backup_enabled
collation = var.mysql_collation


depends_on = [
Expand Down
6 changes: 6 additions & 0 deletions terraform/gcp/modules/sigstore/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ variable "mysql_binary_log_backup_enabled" {
default = true
}

variable "mysql_collation" {
type = string
description = "collation setting for database"
default = "utf8_general_ci"
}

variable "fulcio_keyring_name" {
type = string
description = "Name of Fulcio keyring."
Expand Down

0 comments on commit 4fdf325

Please sign in to comment.