Skip to content

Commit

Permalink
Require explicit region/zone parameters, remove defaults (#184)
Browse files Browse the repository at this point in the history
  • Loading branch information
henrybell authored Jan 11, 2024
1 parent dac8d99 commit 883d704
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 44 deletions.
2 changes: 2 additions & 0 deletions terraform/cloud-functions/distributed/app-project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module "spanner" {
terraform_spanner_state = var.terraform_spanner_state
terraform_spanner_test = var.terraform_spanner_test
project_id = var.project_id
region = var.region
spanner_name = var.spanner_name
spanner_state_name = var.spanner_state_name
spanner_test_processing_units = var.spanner_test_processing_units
Expand All @@ -63,6 +64,7 @@ module "scheduler" {
source = "../../../modules/scheduler"

project_id = var.project_id
location = var.region
spanner_name = var.spanner_name
pubsub_topic = module.forwarder.forwarder_topic
target_pubsub_topic = data.terraform_remote_state.autoscaler.outputs.scaler_topic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ variable "project_id" {
}

variable "region" {
type = string
default = "us-central1"
type = string
}

variable "zone" {
type = string
default = "us-central1-c"
type = string
}

variable "spanner_name" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module "autoscaler-functions" {
source = "../../../modules/autoscaler-functions"

project_id = var.project_id
region = var.region
poller_sa_email = google_service_account.poller_sa.email
scaler_sa_email = google_service_account.scaler_sa.email
forwarder_sa_emails = var.forwarder_sa_emails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ variable "project_id" {
}

variable "region" {
type = string
default = "us-central1"
type = string
}

variable "zone" {
type = string
default = "us-central1-c"
type = string
}

variable "forwarder_sa_emails" {
Expand Down
3 changes: 3 additions & 0 deletions terraform/cloud-functions/per-project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ module "autoscaler-functions" {
source = "../../modules/autoscaler-functions"

project_id = var.project_id
region = var.region
poller_sa_email = google_service_account.poller_sa.email
scaler_sa_email = google_service_account.scaler_sa.email
}
Expand All @@ -69,6 +70,7 @@ module "spanner" {
terraform_spanner_state = var.terraform_spanner_state
terraform_spanner_test = var.terraform_spanner_test
project_id = local.app_project_id
region = var.region
spanner_name = var.spanner_name
spanner_state_name = var.spanner_state_name
spanner_test_processing_units = var.spanner_test_processing_units
Expand All @@ -81,6 +83,7 @@ module "scheduler" {
source = "../../modules/scheduler"

project_id = var.project_id
location = var.region
spanner_name = var.spanner_name
pubsub_topic = module.autoscaler-functions.poller_topic
target_pubsub_topic = module.autoscaler-functions.scaler_topic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func TestPerProjectEndToEndDeployment(t *testing.T) {
TerraformDir: terraformDir,
Vars: map[string]interface{}{
"project_id": config.ProjectId,
"region": "us-central1",
"zone": "us-central1-a",
"spanner_name": spannerName,
"terraform_spanner_test": true,
"spanner_test_processing_units": spannerTestProcessingUnits,
Expand Down
6 changes: 2 additions & 4 deletions terraform/cloud-functions/per-project/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ variable "project_id" {
}

variable "region" {
type = string
default = "us-central1"
type = string
}

variable "zone" {
type = string
default = "us-central1-c"
type = string
}

variable "spanner_name" {
Expand Down
1 change: 1 addition & 0 deletions terraform/gke/decoupled/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ module "spanner" {
terraform_spanner_state = var.terraform_spanner_state
terraform_spanner_test = var.terraform_spanner_test
project_id = var.project_id
region = var.region
spanner_name = var.spanner_name
spanner_state_name = var.spanner_state_name
spanner_test_processing_units = var.spanner_test_processing_units
Expand Down
6 changes: 2 additions & 4 deletions terraform/gke/decoupled/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ variable "project_id" {
}

variable "region" {
type = string
default = "us-central1"
type = string
}

variable "zone" {
type = string
default = "us-central1-c"
type = string
}

variable "spanner_name" {
Expand Down
1 change: 1 addition & 0 deletions terraform/gke/unified/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module "spanner" {
terraform_spanner_state = var.terraform_spanner_state
terraform_spanner_test = var.terraform_spanner_test
project_id = var.project_id
region = var.region
spanner_name = var.spanner_name
spanner_state_name = var.spanner_state_name
spanner_test_processing_units = var.spanner_test_processing_units
Expand Down
6 changes: 2 additions & 4 deletions terraform/gke/unified/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ variable "project_id" {
}

variable "region" {
type = string
default = "us-central1"
type = string
}

variable "zone" {
type = string
default = "us-central1-c"
type = string
}

variable "spanner_name" {
Expand Down
5 changes: 0 additions & 5 deletions terraform/modules/autoscaler-base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ variable "project_id" {
type = string
}

variable "region" {
type = string
default = "us-central1"
}

variable "poller_sa_email" {
type = string
}
Expand Down
3 changes: 1 addition & 2 deletions terraform/modules/autoscaler-functions/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ variable "project_id" {
}

variable "region" {
type = string
default = "us-central1"
type = string
}

variable "nodejs_version" {
Expand Down
5 changes: 0 additions & 5 deletions terraform/modules/firestore/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,3 @@ variable "poller_sa_email" {
variable "scaler_sa_email" {
type = string
}

variable "region" {
type = string
default = "us-central1"
}
3 changes: 1 addition & 2 deletions terraform/modules/forwarder/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ variable "project_id" {
}

variable "region" {
type = string
default = "us-central1"
type = string
}

variable "nodejs_version" {
Expand Down
2 changes: 1 addition & 1 deletion terraform/modules/scheduler/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ locals {

resource "google_app_engine_application" "app" {
project = var.project_id
location_id = var.location
location_id = var.location == "us-central1" ? "us-central" : var.location
}

resource "google_cloud_scheduler_job" "poller_job" {
Expand Down
3 changes: 1 addition & 2 deletions terraform/modules/scheduler/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ variable "project_id" {
}

variable "location" {
type = string
default = "us-central"
type = string
}

variable "schedule" {
Expand Down
13 changes: 6 additions & 7 deletions terraform/modules/spanner/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ variable "project_id" {
type = string
}

variable "region" {
type = string
}

variable "terraform_spanner_test" {
description = "If set to true, Terraform will create a Cloud Spanner instance and DB."
type = bool
Expand All @@ -42,12 +46,12 @@ variable "spanner_state_processing_units" {

variable "spanner_name" {
description = "Name of the Spanner instance to be autoscaled."
type = string
type = string
}

variable "spanner_state_name" {
description = "Name of the Spanner instance where the Autoscaler state is stored."
type = string
type = string
}

variable "poller_sa_email" {
Expand All @@ -57,8 +61,3 @@ variable "poller_sa_email" {
variable "scaler_sa_email" {
type = string
}

variable "region" {
type = string
default = "us-central1"
}

0 comments on commit 883d704

Please sign in to comment.