cloud-foundation-fabric/examples/data-solutions/data-platform-foundations/main.tf

56 lines
2.7 KiB
Terraform
Raw Normal View History

2022-01-17 23:58:14 -08:00
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
2022-02-01 00:09:53 -08:00
# tfdoc:file:description Core locals.
2022-01-31 21:41:33 -08:00
2022-01-17 23:58:14 -08:00
locals {
2022-02-03 05:25:46 -08:00
_networks = {
load = {
2022-02-08 08:46:34 -08:00
network_name = coalesce(local._shared_vpc_network, module.lod-vpc[0].name)
network = coalesce(var.network_config.network_self_link, module.lod-vpc[0].self_link)
subnet = try(var.network_config.subnet_self_links.load, module.lod-vpc[0].subnet_self_links["${var.location_config.region}/${local.prefix_lod}-subnet"])
2022-02-03 05:25:46 -08:00
}
orchestration = {
2022-02-08 08:46:34 -08:00
network_name = coalesce(local._shared_vpc_network, module.orc-vpc[0].name)
network = coalesce(var.network_config.network_self_link, module.orc-vpc[0].self_link)
subnet = try(var.network_config.subnet_self_links.orchestration, module.orc-vpc[0].subnet_self_links["${var.location_config.region}/${local.prefix_orc}-subnet"])
2022-02-03 05:25:46 -08:00
}
transformation = {
2022-02-08 08:46:34 -08:00
network_name = coalesce(local._shared_vpc_network, module.trf-vpc[0].name)
network = coalesce(var.network_config.network_self_link, module.trf-vpc[0].self_link)
subnet = try(var.network_config.subnet_self_links.transformation, module.trf-vpc[0].subnet_self_links["${var.location_config.region}/${local.prefix_trf}-subnet"])
2022-02-03 05:25:46 -08:00
}
}
2022-02-08 08:46:34 -08:00
_shared_vpc_network = try(regex("[a-z]([-a-z0-9]*[a-z0-9])?$", var.network_config.network_self_link), null)
2022-02-07 14:16:47 -08:00
_shared_vpc_project = try(regex("projects/([a-z0-9-]{6,30})", var.network_config.network_self_link)[0], null)
2022-02-07 12:28:54 -08:00
_shared_vpc_service_config = var.network_config.network_self_link != null ? {
2022-02-03 05:25:46 -08:00
attach = true
2022-02-07 12:28:54 -08:00
host_project = local._shared_vpc_project
2022-02-03 05:25:46 -08:00
} : null
groups = { for k, v in var.groups : k => "${v}@${var.organization.domain}" }
groups_iam = { for k, v in local.groups : k => "group:${v}" }
service_encryption_keys = var.service_encryption_keys
2022-02-08 08:46:34 -08:00
# To create KMS keys in the common projet: uncomment assignement below and comment assignement above
# service_encryption_keys = {
# bq = module.sec-kms-1.key_ids.bq
# composer = module.sec-kms-2.key_ids.composer
# dataflow = module.sec-kms-2.key_ids.dataflow
# storage = module.sec-kms-1.key_ids.storage
# pubsub = module.sec-kms-0.key_ids.pubsub
# }
2022-01-17 23:58:14 -08:00
}