-
Arun Patel authoredArun Patel authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
locals.tf 1.14 KiB
# locals.tf defines common expressions used by the module.
locals {
# Project containing existing Cloud SQL instance.
sql_instance_project = coalesce(var.sql_instance_project, var.project)
# Should a DNS domain mapping be created?
domain_mapping_present = var.dns_name != ""
# Do we need to enable the 'beta' launch stage - only required if certain beta
# functionality is being used, or if `enable_beta_launch_stage` is set downstream.
enable_beta_launch_stage = (
var.enable_beta_launch_stage || length(var.secrets_volume) != 0 || length(var.secrets_envars) != 0
)
# Whether we should monitor the custom domain - only possible if there is a dns_name
# set and unauthenticated invocation is enabled
can_monitor_custom_dns = var.dns_name != "" && var.allow_unauthenticated_invocations
# Hosts to monitor. We use the automatic host from Cloud Run and any custom
# domain mapped host, if can_monitor_custom_dns is true
monitor_hosts = var.disable_monitoring ? [] : concat(
[trimsuffix(trimprefix(google_cloud_run_service.webapp.status[0].url, "https://"), "/")],
local.can_monitor_custom_dns ? [var.dns_name] : []
)
}