-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
119 lines (112 loc) · 2.22 KB
/
main.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
terraform {
required_version = "= 1.5.7"
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "3.0.2"
}
github = {
source = "integrations/github"
version = "6.5.0"
}
google = {
source = "hashicorp/google"
version = "6.20.0"
}
}
backend "gcs" {
bucket = "libops-ghat-terraform"
prefix = "/github"
}
}
provider "google" {
alias = "default"
project = var.project
}
provider "docker" {
alias = "local"
registry_auth {
address = "us-docker.pkg.dev"
config_file = pathexpand("~/.docker/config.json")
}
}
module "vault" {
source = "./modules/vault"
project = var.project
name = "ghat"
}
module "ghat" {
source = "./modules/cloudrun"
name = "ghat"
project = var.project
gsa = module.vault.gsa
containers = [
{
name = "ghat",
image = "us-docker.pkg.dev/${var.project}/private/ghat:main",
port = 8080,
liveness_probe = "/healthcheck",
memory = "512Mi",
cpu = "1000m",
volume_mounts = [
{
name = "vault-secrets",
mount_path = "/vault/secrets"
}
]
},
{
name = "vault",
image = "hashicorp/vault:1.18.3",
memory = "512Mi",
cpu = "500m",
args = [
"agent",
"-config=/etc/vault/agent.hcl"
],
volume_mounts = [
{
name = "vault-secrets",
mount_path = "/vault/secrets"
},
{
name = "vault-config",
mount_path = "/etc/vault"
},
]
}
]
empty_dir_volumes = [
{
name = "vault-secrets"
}
]
gcs_volumes = [
{
name = "vault-config"
bucket = module.vault.bucket
}
]
addl_env_vars = tolist([
{
name = "GITHUB_APP_ID"
value = var.gh_app_id
},
{
name = "GITHUB_INSTALL_ID"
value = var.gh_install_id
},
{
name = "GITHUB_APP_PRIVATE_KEY"
value = "/vault/secrets/gha-private.pem"
},
{
name = "VAULT_ADDR"
value = var.vault_addr
}
])
providers = {
google = google.default
docker = docker.local
}
}