-
Notifications
You must be signed in to change notification settings - Fork 0
/
iam.tf
105 lines (99 loc) · 3.23 KB
/
iam.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* Copyright 2018 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
*
* http://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.
*/
locals {
all_dicom_iam_members = flatten([
for s in var.dicom_stores : [
for m in lookup(s, "iam_members", []) : {
store_name = s.name
role = m.role
member = m.member
}
]
])
all_fhir_iam_members = flatten([
for s in var.fhir_stores : [
for m in lookup(s, "iam_members", []) : {
store_name = s.name
role = m.role
member = m.member
}
]
])
all_hl7_v2_iam_members = flatten([
for s in var.hl7_v2_stores : [
for m in lookup(s, "iam_members", []) : {
store_name = s.name
role = m.role
member = m.member
}
]
])
all_consent_iam_members = flatten([
for s in var.consent_stores : [
for m in lookup(s, "iam_members", []) : {
store_name = s.name
role = m.role
member = m.member
}
]
])
}
resource "google_healthcare_dataset_iam_member" "dataset_iam_members" {
for_each = {
for m in var.iam_members :
"${m.role} ${m.member}" => m
}
dataset_id = google_healthcare_dataset.dataset.id
role = each.value.role
member = each.value.member
}
resource "google_healthcare_dicom_store_iam_member" "dicom_store_iam_members" {
for_each = {
for m in local.all_dicom_iam_members :
"${m.store_name} ${m.role} ${m.member}" => m
}
dicom_store_id = google_healthcare_dicom_store.dicom_stores[each.value.store_name].id
role = each.value.role
member = each.value.member
}
resource "google_healthcare_fhir_store_iam_member" "fhir_store_iam_members" {
for_each = {
for m in local.all_fhir_iam_members :
"${m.store_name} ${m.role} ${m.member}" => m
}
fhir_store_id = google_healthcare_fhir_store.fhir_stores[each.value.store_name].id
role = each.value.role
member = each.value.member
}
resource "google_healthcare_hl7_v2_store_iam_member" "hl7_v2_store_iam_members" {
for_each = {
for m in local.all_hl7_v2_iam_members :
"${m.store_name} ${m.role} ${m.member}" => m
}
hl7_v2_store_id = google_healthcare_hl7_v2_store.hl7_v2_stores[each.value.store_name].id
role = each.value.role
member = each.value.member
}
resource "google_healthcare_consent_store_iam_member" "consent_store_iam_members" {
for_each = {
for m in local.all_consent_iam_members :
"${m.store_name} ${m.role} ${m.member}" => m
}
consent_store_id = google_healthcare_consent_store.consent_stores[each.value.store_name].id
dataset = google_healthcare_consent_store.consent_stores[each.value.store_name].dataset
role = each.value.role
member = each.value.member
}