diff --git a/deploy/terraform-custom-datacommons/modules/locals.tf b/deploy/terraform-custom-datacommons/modules/locals.tf index b7256626ee..459ea3f0d4 100644 --- a/deploy/terraform-custom-datacommons/modules/locals.tf +++ b/deploy/terraform-custom-datacommons/modules/locals.tf @@ -25,10 +25,16 @@ locals { # Use var.billing_project_id if set, otherwise use project_id for billing billing_project_id = var.billing_project_id != null ? var.billing_project_id : var.project_id + + # Data Commons API hostname + dc_api_hostname = "api.datacommons.org" - # Data Commons API root url - dc_api_root = "${var.dc_api_protocol}://${var.dc_api_hostname}" + # Data Commons API protocol + dc_api_protocol = "https" + # Data Commons API root URL + dc_api_root = "${local.dc_api_protocol}://${local.dc_api_hostname}" + # Shared environment variables used by the Data Commons web service and the Data # Commons data loading job cloud_run_shared_env_variables = [ diff --git a/deploy/terraform-custom-datacommons/modules/variables.tf b/deploy/terraform-custom-datacommons/modules/variables.tf index 6a89ac7ed7..6076fbe56d 100644 --- a/deploy/terraform-custom-datacommons/modules/variables.tf +++ b/deploy/terraform-custom-datacommons/modules/variables.tf @@ -15,6 +15,7 @@ # Variable definitions # Required variables + variable "project_id" { description = "The GCP project ID where the solution will be deployed" type = string @@ -31,15 +32,8 @@ variable "dc_api_key" { } # Optional variables -# Set to your Google Analytics Tag ID to enable Google Analytics tracking. -# Reference: https://support.google.com/analytics/answer/9539598 -variable "google_analytics_tag_id" { - description = "Google Analytics Tag ID" - type = string - default = null -} -# Optional: If blank will use generated maps API key +# Optional: If blank, will generate a Maps API key. variable "maps_api_key" { description = "Google Maps API Key" type = string @@ -64,64 +58,28 @@ variable billing_project_id { default = null } -variable "vpc_network_name" { - description = "VPC network name to use" - type = string - default = "default" -} - -variable "vpc_network_subnet_name" { - description = "VPC network subnet name to use" - type = string - default = "default" -} - -variable "vpc_base_cidr_block" { - description = "Base CIDR block to be subdivided for VPC connectors" - type = string - default = "10.8.0.0/24" -} - -variable "enable_redis" { - description = "Enable redis instance in this deployment" - type = bool - default = false -} - -variable "redis_instance_name" { - description = "Name of the redis instance" +variable "google_analytics_tag_id" { + description = "Google Analytics Tag ID" type = string - default = "datacommons-redis-instance" -} -variable "redis_memory_size_gb" { - description = "The memory size for the Redis instance in GB" - type = number - default = 2 + default = null } -variable "redis_tier" { - description = "The service tier for the Redis instance" - type = string - default = "STANDARD_HA" -} +# Data Commons Cloud Storage bucket variables -variable "redis_location_id" { - description = "Redis location id (zone)" +# If not set, the default is -datacommons-data- +variable "dc_gcs_data_bucket_path_override" { + description = "Custom GCS data bucket path." type = string - default = "us-central1-a" + default = "" } -variable "redis_alternative_location_id" { - description = "Redis alternate location id (alternate zone)" +variable "dc_gcs_data_bucket_location" { + description = "Data Commons GCS data bucket location" type = string - default = "us-central1-b" + default = "US" } -variable "redis_replica_count" { - description = "Redis reserved IP range" - type = number - default = 1 -} +# Data Commons Cloud SQL instance variables variable "mysql_instance_name" { description = "The name of the MySQL instance" @@ -129,6 +87,12 @@ variable "mysql_instance_name" { default = "datacommons-mysql-instance" } +variable mysql_database_name { + description = "MySQL database name" + type = string + default = "datacommons" +} + variable "mysql_database_version" { description = "The version of MySQL" type = string @@ -155,12 +119,6 @@ variable "mysql_storage_size_gb" { default = 20 } -variable mysql_database_name { - description = "MySQL database name" - type = string - default = "datacommons" -} - variable "mysql_user" { description = "The username for the MySQL instance" type = string @@ -173,7 +131,8 @@ variable "mysql_deletion_protection" { default = false } -## Data Commons Cloud Run service variables +# Data Commons Cloud Run service variables + variable "dc_web_service_image" { description = "Container image for Cloud Run service" type = string @@ -192,6 +151,14 @@ variable "dc_web_service_memory" { default = "16G" } +variable "make_dc_web_service_public" { + description = "Whether to make the Data Commons Cloud Run service publicly accessible" + type = bool + default = true +} + +# Data Commons Cloud Run job variables + variable "dc_data_job_image" { description = "The container image for the data job" type = string @@ -210,32 +177,65 @@ variable "dc_data_job_memory" { default = "8G" } -variable "dc_api_hostname" { - description = "Data Commons API hostname" +# Data Commons Cloud VPC Network variables + +variable "vpc_network_name" { + description = "VPC network name to use" type = string - default = "api.datacommons.org" + default = "default" } -variable "dc_api_protocol" { - description = "Data Commons API protocol" +variable "vpc_network_subnet_name" { + description = "VPC network subnet name to use" type = string - default = "https" + default = "default" } -variable "dc_gcs_data_bucket_path_override" { - description = "[Optional] Set a custom GCS data bucket path" +variable "vpc_base_cidr_block" { + description = "Base CIDR block to be subdivided for VPC connectors" type = string - default = "" + default = "10.8.0.0/24" } -variable "dc_gcs_data_bucket_location" { - description = "Data Commons data bucket GCS location" +# Data Commons Cloud Redis Memorystore instance variables + +variable "enable_redis" { + description = "Enable redis instance in this deployment" + type = bool + default = false +} + +variable "redis_instance_name" { + description = "Name of the redis instance" type = string - default = "US" + default = "datacommons-redis-instance" +} +variable "redis_memory_size_gb" { + description = "The memory size for the Redis instance in GB" + type = number + default = 2 } -variable "make_dc_web_service_public" { - description = "Whether to make the Data Commons Cloud Run service publicly accessible" - type = bool - default = true +variable "redis_tier" { + description = "The service tier for the Redis instance" + type = string + default = "STANDARD_HA" } + +variable "redis_location_id" { + description = "Redis location id (zone)" + type = string + default = "us-central1-a" +} + +variable "redis_alternative_location_id" { + description = "Redis alternate location id (alternate zone)" + type = string + default = "us-central1-b" +} + +variable "redis_replica_count" { + description = "Redis reserved IP range" + type = number + default = 1 +} \ No newline at end of file