-
Notifications
You must be signed in to change notification settings - Fork 0
/
vault-kms-auto-unseal.tf
61 lines (49 loc) · 1.75 KB
/
vault-kms-auto-unseal.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
# resource "google_service_account" "vault_kms_service_account" {
# account_id = "vault-gcpkms"
# display_name = "Vault KMS for auto-unseal"
# }
# resource "google_compute_instance" "vault" {
# name = "quangpham5-vault-test"
# machine_type = "e2-small"
# zone = var.gcloud-zone
# boot_disk {
# initialize_params {
# image = "ubuntu-os-cloud/ubuntu-2004-lts"
# }
# }
# network_interface {
# network = data.google_compute_network.quangpham5
# subnetwork = data.google_compute_subnetwork.internal-subnetwork
# access_config {
# # Ephemeral IP
# }
# }
# allow_stopping_for_update = true
# # Service account with Cloud KMS roles for the Compute Instance
# service_account {
# email = google_service_account.vault_kms_service_account.email
# scopes = ["cloud-platform", "compute-rw", "userinfo-email", "storage-ro"]
# }
# metadata_startup_script = "${file("./startup_script_vault.sh")}"
# }
# # Create a KMS key ring
# resource "google_kms_key_ring" "key_ring" {
# project = "${var.gcloud-project}"
# name = "${var.key_ring}"
# location = "${var.keyring_location}"
# }
# # Create a crypto key for the key ring
# resource "google_kms_crypto_key" "crypto_key" {
# name = "${var.crypto_key}"
# key_ring = "${google_kms_key_ring.key_ring.self_link}"
# rotation_period = "100000s"
# }
# # Add the service account to the Keyring
# resource "google_kms_key_ring_iam_binding" "vault_iam_kms_binding" {
# key_ring_id = "${google_kms_key_ring.key_ring.id}"
# # key_ring_id = "${var.gcloud-project}/${var.keyring_location}/${var.key_ring}"
# role = "roles/owner"
# members = [
# "serviceAccount:${google_service_account.vault_kms_service_account.email}",
# ]
# }