cloud-foundation-fabric/blueprints/data-solutions/data-platform-foundations/06-common.tf

106 lines
3.5 KiB
Terraform
Raw Normal View History

2022-01-21 09:40:11 -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-02 06:31:54 -08:00
# tfdoc:file:description common project.
2022-01-31 21:41:33 -08:00
locals {
iam_common = {
2023-02-21 16:36:01 -08:00
"roles/dlp.admin" = [local.groups_iam.data-security]
"roles/dlp.estimatesAdmin" = [local.groups_iam.data-engineers]
"roles/dlp.reader" = [local.groups_iam.data-engineers]
2022-01-21 09:40:11 -08:00
"roles/dlp.user" = [
2022-02-09 08:01:25 -08:00
module.load-sa-df-0.iam_email,
2023-02-21 16:36:01 -08:00
module.transf-sa-df-0.iam_email,
local.groups_iam.data-engineers
2022-01-21 09:40:11 -08:00
]
2023-02-21 16:36:01 -08:00
"roles/datacatalog.admin" = [local.groups_iam.data-security]
2022-04-01 09:25:05 -07:00
"roles/datacatalog.viewer" = [
module.load-sa-df-0.iam_email,
module.transf-sa-df-0.iam_email,
2023-02-21 16:36:01 -08:00
module.transf-sa-bq-0.iam_email,
local.groups_iam.data-analysts
2022-04-01 09:25:05 -07:00
]
"roles/datacatalog.categoryFineGrainedReader" = [
module.transf-sa-df-0.iam_email,
module.transf-sa-bq-0.iam_email,
# Uncomment if you want to grant access to `data-analyst` to all columns tagged.
# local.groups_iam.data-analysts
]
2022-01-21 09:40:11 -08:00
}
}
module "common-project" {
source = "../../../modules/project"
parent = var.project_config.parent
billing_account = var.project_config.billing_account_id
project_create = var.project_config.billing_account_id != null
prefix = var.project_config.billing_account_id == null ? null : var.prefix
name = var.project_config.billing_account_id == null ? var.project_config.project_ids.common : "${var.project_config.project_ids.common}${local.project_suffix}"
2023-02-21 16:36:01 -08:00
iam = var.project_config.billing_account_id != null ? local.iam_common : null
iam_additive = var.project_config.billing_account_id == null ? local.iam_common : null
2022-01-21 09:40:11 -08:00
services = concat(var.project_services, [
2022-02-02 07:51:14 -08:00
"datacatalog.googleapis.com",
2022-01-21 09:40:11 -08:00
"dlp.googleapis.com",
])
}
2022-03-29 03:06:45 -07:00
# Data Catalog Policy tag
module "common-datacatalog" {
source = "../../../modules/data-catalog-policy-tag"
project_id = module.common-project.project_id
2022-04-04 06:38:36 -07:00
name = "${var.prefix}-datacatalog-policy-tags"
2022-03-29 03:06:45 -07:00
location = var.location
tags = var.data_catalog_tags
}
2022-02-08 08:46:34 -08:00
# To create KMS keys in the common projet: uncomment this section and assigne key links accondingly in local.service_encryption_keys variable
2022-01-21 09:40:11 -08:00
2022-02-02 07:51:14 -08:00
# module "cmn-kms-0" {
2022-01-31 09:58:55 -08:00
# source = "../../../modules/kms"
# project_id = module.common-project.project_id
2022-01-31 09:58:55 -08:00
# keyring = {
# name = "${var.prefix}-kr-global",
# location = "global"
2022-01-31 09:58:55 -08:00
# }
# keys = {
# pubsub = null
# }
# }
2022-02-02 07:51:14 -08:00
# module "cmn-kms-1" {
2022-01-31 09:58:55 -08:00
# source = "../../../modules/kms"
# project_id = module.common-project.project_id
2022-01-31 09:58:55 -08:00
# keyring = {
# name = "${var.prefix}-kr-mregional",
# location = var.location
2022-01-31 09:58:55 -08:00
# }
# keys = {
# bq = null
# storage = null
# }
# }
2022-01-21 09:40:11 -08:00
2022-02-02 07:51:14 -08:00
# module "cmn-kms-2" {
2022-01-31 09:58:55 -08:00
# source = "../../../modules/kms"
2022-02-02 07:51:14 -08:00
# project_id = module.cmn-prj.project_id
2022-01-31 09:58:55 -08:00
# keyring = {
# name = "${var.prefix}-kr-regional",
# location = var.region
2022-01-31 09:58:55 -08:00
# }
# keys = {
# composer = null
# dataflow = null
# }
# }