-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01-landing.tf
63 lines (59 loc) · 1.89 KB
/
01-landing.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Samuel Berthollier - 2024
#
# Unless required by applicable law or agreed to in writing, software
# distributed is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, either express or implied.
# Setting local variables for IAM
locals {
lnd_services = [
"bigquerydatatransfer.googleapis.com",
"bigquery.googleapis.com",
"bigquerystorage.googleapis.com",
"iam.googleapis.com",
"analyticshub.googleapis.com",
"bigqueryconnection.googleapis.com",
"aiplatform.googleapis.com"
]
iam_lnd = {
"roles/bigquery.admin" = [
module.land-sa-0.iam_email
]
"roles/iam.serviceAccountTokenCreator" = [
module.land-sa-0.iam_email
]
}
}
# Defining the project that will host the Dataset
module "land-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.landing
: "${var.project_config.project_ids.landing}${local.project_suffix}"
)
iam = (
var.project_config.billing_account_id == null ? {} : local.iam_lnd
)
services = local.lnd_services
}
# Defining the service account that will be used for copying the Dataset
module "land-sa-0" {
source = "../modules/iam-service-account"
project_id = module.land-project.project_id
prefix = var.prefix
name = "lnd-sa-0"
display_name = "Common service account."
}
resource "google_project_iam_member" "iam_lnd" {
for_each = { for role, members in local.iam_lnd : role => members }
role = each.key
member = each.value[0]
project = module.land-project.project_id
depends_on = [module.land-sa-0]
}