-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecrets.tf
63 lines (50 loc) · 2.08 KB
/
secrets.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
#####################################################################
# region: Secrets - SSV Node Operator
resource "google_secret_manager_secret" "encrypted_key" {
secret_id = local.ssv.secrets.encrypted_key_id
labels = {
# Add any labels to the secret that are relevant
}
# Warning: Changing replication values will cause deletion
replication {
auto {}
}
}
resource "google_secret_manager_secret" "password" {
secret_id = local.ssv.secrets.password_id
labels = {
# Add any labels to the secret that are relevant
}
# Warning: Changing replication values will cause deletion
replication {
auto {}
}
}
# endregion
#####################################################################
# region: Grant read and write access for the encrypted key secret
resource "google_secret_manager_secret_iam_member" "encrypted_key_read" {
secret_id = google_secret_manager_secret.encrypted_key.secret_id
role = "roles/secretmanager.secretAccessor"
member = "serviceAccount:${google_service_account.vm_service_account.email}"
}
resource "google_secret_manager_secret_iam_member" "encrypted_key_write" {
secret_id = google_secret_manager_secret.encrypted_key.secret_id
role = "roles/secretmanager.secretVersionManager"
member = "serviceAccount:${google_service_account.vm_service_account.email}"
}
# endregion
#####################################################################
# region: Grant read and write access for the password secret
resource "google_secret_manager_secret_iam_member" "password_read" {
secret_id = google_secret_manager_secret.password.secret_id
role = "roles/secretmanager.secretAccessor"
member = "serviceAccount:${google_service_account.vm_service_account.email}"
}
resource "google_secret_manager_secret_iam_member" "password_write" {
secret_id = google_secret_manager_secret.password.secret_id
role = "roles/secretmanager.secretVersionManager"
member = "serviceAccount:${google_service_account.vm_service_account.email}"
}
# endregion
#####################################################################