From 5eaa8420603d3105da30cc7cfa6c868392e9d594 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 13 Nov 2023 17:32:09 -0800 Subject: [PATCH 1/2] add support for specifying a different mysql version for each ctlog shard Signed-off-by: Priya Wadhwa --- terraform/gcp/modules/sigstore/sigstore.tf | 4 ++-- terraform/gcp/modules/sigstore/variables.tf | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/terraform/gcp/modules/sigstore/sigstore.tf b/terraform/gcp/modules/sigstore/sigstore.tf index 511527089..2752a2246 100644 --- a/terraform/gcp/modules/sigstore/sigstore.tf +++ b/terraform/gcp/modules/sigstore/sigstore.tf @@ -329,7 +329,7 @@ module "ctlog" { module "ctlog_shards" { source = "../mysql-shard" - for_each = toset(var.ctlog_shards) + for_each = var.ctlog_shards instance_name = format("%s-ctlog-%s", var.cluster_name, each.key) @@ -339,7 +339,7 @@ module "ctlog_shards" { cluster_name = var.cluster_name // NB: These are commented out so that we pick up the defaults // for the particular environment consistently. - //mysql_database_version = var.mysql_db_version + database_version = each.value["mysql_db_version"] //mysql_tier = var.mysql_tier replica_zones = var.mysql_replica_zones diff --git a/terraform/gcp/modules/sigstore/variables.tf b/terraform/gcp/modules/sigstore/variables.tf index de3cef42d..f067464f4 100644 --- a/terraform/gcp/modules/sigstore/variables.tf +++ b/terraform/gcp/modules/sigstore/variables.tf @@ -293,9 +293,12 @@ variable "dns_domain_name" { } variable "ctlog_shards" { - type = list(string) - description = "Array of CTLog shards to create. Entry should be something like [2021, 2022], which would then have 2 independent CTLog shards backed by ctlog-2021 and ctlog-2022 Cloud SQL instances." - default = [] + type = map(object({ + mysql_db_version = string + })) + + description = "Map of CTLog shards to create. If keys are '2022' and '2023', it would create 2 independent CTLog Cloud MySql instances named sigstore-staging-ctlog-2022 and sigstore-staging-ctlog-2023." + default = {} } variable "standalone_mysqls" { From 65d4a61028c918bb290df79dea79789d5a85314a Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Mon, 13 Nov 2023 17:45:39 -0800 Subject: [PATCH 2/2] move comment Signed-off-by: Priya Wadhwa --- terraform/gcp/modules/sigstore/sigstore.tf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/terraform/gcp/modules/sigstore/sigstore.tf b/terraform/gcp/modules/sigstore/sigstore.tf index 2752a2246..8b53daa28 100644 --- a/terraform/gcp/modules/sigstore/sigstore.tf +++ b/terraform/gcp/modules/sigstore/sigstore.tf @@ -337,9 +337,11 @@ module "ctlog_shards" { region = var.region cluster_name = var.cluster_name - // NB: These are commented out so that we pick up the defaults - // for the particular environment consistently. + database_version = each.value["mysql_db_version"] + + // NB: This is commented out so that we pick up the defaults + // for the particular environment consistently. //mysql_tier = var.mysql_tier replica_zones = var.mysql_replica_zones