-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprovider.tf
67 lines (58 loc) · 2.07 KB
/
provider.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
# Specify required provider as maintained by civo
terraform {
required_providers {
civo = {
source = "civo/civo"
}
postgresql = {
source = "cyrilgdn/postgresql"
version = "1.21.0"
}
random = {
source = "hashicorp/random"
version = "3.5.1"
}
# Used to output the kubeconfig to the local dir for local cluster access
local = {
source = "hashicorp/local"
version = "2.4.1"
}
# Used to provision helm charts into the k8s cluster
helm = {
source = "hashicorp/helm"
version = "2.12.1"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.25.2"
}
}
}
# Configure the Civo Provider
provider "civo" {
token = var.civo_token
region = var.region
}
provider "postgresql" {
host = civo_database.coder_database.endpoint
port = 5432
username = civo_database.coder_database.username
password = civo_database.coder_database.password
sslmode = "require"
connect_timeout = 15
superuser = false
}
provider "kubernetes" {
host = civo_kubernetes_cluster.cluster.api_endpoint
client_certificate = base64decode(yamldecode(civo_kubernetes_cluster.cluster.kubeconfig).users[0].user.client-certificate-data)
client_key = base64decode(yamldecode(civo_kubernetes_cluster.cluster.kubeconfig).users[0].user.client-key-data)
cluster_ca_certificate = base64decode(yamldecode(civo_kubernetes_cluster.cluster.kubeconfig).clusters[0].cluster.certificate-authority-data)
}
provider "helm" {
kubernetes {
host = civo_kubernetes_cluster.cluster.api_endpoint
client_certificate = base64decode(yamldecode(civo_kubernetes_cluster.cluster.kubeconfig).users[0].user.client-certificate-data)
client_key = base64decode(yamldecode(civo_kubernetes_cluster.cluster.kubeconfig).users[0].user.client-key-data)
cluster_ca_certificate = base64decode(yamldecode(civo_kubernetes_cluster.cluster.kubeconfig).clusters[0].cluster.certificate-authority-data)
}
}