-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
51 lines (44 loc) · 1.11 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
locals {
auth_credentials = var.git_type == "bitbucket" && var.git_app_username != "" ? {
RENOVATE_USERNAME = var.git_app_username
RENOVATE_PASSWORD = var.git_token
} : {
RENOVATE_TOKEN = var.git_token
}
}
resource "tls_private_key" "encryption" {
algorithm = "RSA"
rsa_bits = 4096
}
resource "kubernetes_secret" "private_key" {
metadata {
name = format("%s-key", var.name)
namespace = var.k8s_namespace
}
data = {
"decrypt.key" = tls_private_key.encryption.private_key_pem
}
}
resource "kubernetes_secret" "renovate_secrets" {
metadata {
name = var.name
namespace = var.k8s_namespace
}
data = local.auth_credentials
}
resource "kubernetes_config_map" "renovate_config" {
metadata {
name = var.name
namespace = var.k8s_namespace
}
data = {
"config.json" = jsonencode({
gitAuthor = "Renovate Bot <[email protected]>"
platform = var.git_type
endpoint = var.git_endpoint
repositories = var.repositories
privateKeyPath = "/usr/src/app/decrypt.key"
trustLevel = "low"
})
}
}