-
Notifications
You must be signed in to change notification settings - Fork 0
/
secrets.tf
70 lines (70 loc) · 2.51 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
64
65
66
67
68
69
70
resource "google_secret_manager_secret" "DATABASE_PRIVATE_IPV4" {
secret_id = var.private_ip_address_secret_name
replication {
auto {}
}
depends_on = [google_sql_database_instance.main]
}
resource "google_secret_manager_secret_version" "DATABASE_PRIVATE_IPV4_VERSION" {
secret = google_secret_manager_secret.DATABASE_PRIVATE_IPV4.id
secret_data = google_sql_database_instance.main.private_ip_address
depends_on = [google_sql_database_instance.main]
}
resource "google_secret_manager_secret" "DATABASE_PASSWORD" {
secret_id = var.database_password_secret_name
replication {
auto {}
}
depends_on = [random_password.password]
}
resource "google_secret_manager_secret_version" "DATABASE_PASSWORD_VERSION" {
secret = google_secret_manager_secret.DATABASE_PASSWORD.id
secret_data = random_password.password.result
depends_on = [random_password.password]
}
resource "google_secret_manager_secret" "DATABASE_USER" {
secret_id = var.database_user_secret_name
replication {
auto {}
}
depends_on = [google_sql_user.user]
}
resource "google_secret_manager_secret_version" "DATABASE_USER_VERSION" {
secret = google_secret_manager_secret.DATABASE_USER.id
secret_data = google_sql_user.user.name
depends_on = [google_sql_user.user]
}
resource "google_secret_manager_secret" "DATABASE_NAME" {
secret_id = var.database_name_secret_name
replication {
auto {}
}
depends_on = [google_sql_database.database]
}
resource "google_secret_manager_secret_version" "DATABASE_NAME_VERSION" {
secret = google_secret_manager_secret.DATABASE_NAME.id
secret_data = google_sql_database.database.name
depends_on = [google_sql_database.database]
}
resource "google_secret_manager_secret" "VM_KEY_ID" {
secret_id = var.vm_key_id_secret_name
replication {
auto {}
}
depends_on = [google_kms_crypto_key.vm_key]
}
resource "google_secret_manager_secret_version" "VM_KEY_ID_VERSION" {
secret = google_secret_manager_secret.VM_KEY_ID.id
secret_data = google_kms_crypto_key.vm_key.id
depends_on = [google_kms_crypto_key.vm_key]
}
resource "google_secret_manager_secret" "APP_INSTANCE_TEMPLATE_VERSION" {
secret_id = var.app_instance_template_version_secret_name
replication {
auto {}
}
}
resource "google_secret_manager_secret_version" "APP_INSTANCE_TEMPLATE_VERSION_VERSION" {
secret = google_secret_manager_secret.APP_INSTANCE_TEMPLATE_VERSION.id
secret_data = var.app_instance_template_version_secret_data
}