-
Notifications
You must be signed in to change notification settings - Fork 0
/
bucket.tf
70 lines (64 loc) · 1.28 KB
/
bucket.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
locals {
buckets = [
"aaron",
"amparo",
"arturo",
"bill",
"billy",
"cathy",
"charlene",
"david",
"elsie",
"erica",
"ernestine",
"fannie",
"frederic",
"gary",
"george",
"gerald",
"homer",
"jaimie",
"jay",
"john",
"joseph",
"lynn",
"maria",
"matthew",
"patricia",
"patrick",
"paula",
"peggy",
"philip",
"roberta",
"thomas",
]
}
# Stand-in for google_storage_bucket
resource "null_resource" "bucket" {
for_each = {
for pair in setproduct(local.developers, local.buckets) : "${pair[0]}__${pair[1]}" => {
developer = pair[0]
bucket = pair[1]
}
}
provisioner "local-exec" {
command = "echo ${each.value.developer} ${each.value.bucket} ${random_id.bucket_name[each.key].hex} in project ${null_resource.project[each.value.developer].id}"
}
depends_on = [
null_resource.project_service,
]
}
resource "random_id" "bucket_name" {
for_each = {
for pair in setproduct(local.developers, local.buckets) : "${pair[0]}__${pair[1]}" => {
developer = pair[0]
bucket = pair[1]
}
}
byte_length = 4
prefix = "${each.value.bucket}-"
keepers = {
developer = each.value.developer
bucket = each.value.bucket
}
}