-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovider.tf
82 lines (74 loc) · 2.18 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.49.1"
}
rancher2 = {
source = "rancher/rancher2"
version = ">= 3.2.0"
}
flux = {
source = "fluxcd/flux"
version = ">= 1.4.0"
}
tls = {
source = "hashicorp/tls"
version = ">= 4.0.6"
}
kubectl = {
source = "gavinbunney/kubectl"
version = "~> 1.19.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.32.0"
}
github = {
source = "integrations/github"
version = "6.3.1"
}
}
}
provider "rancher2" {
api_url = var.admin_url
token_key = var.admin_token
}
locals {
raw_kubeconfig = nonsensitive(yamldecode(rancher2_cluster.hetzner.kube_config))
}
provider "flux" {
kubernetes = {
host = local.raw_kubeconfig["clusters"][0]["cluster"]["server"]
token = local.raw_kubeconfig["users"][0]["user"]["token"]
insecure = true
}
git = {
url = "ssh://git@github.com/${var.github_repository_owner}/${var.github_repository_name}.git"
ssh = {
username = "git"
private_key = tls_private_key.git-main.private_key_pem
}
}
}
provider "kubectl" {
host = local.raw_kubeconfig["clusters"][0]["cluster"]["server"]
token = local.raw_kubeconfig["users"][0]["user"]["token"]
insecure = true
load_config_file = false
apply_retry_count = 10
}
provider "github" {
owner = var.github_repository_owner
token = var.github_token
}
### Because we use custom nodeTemplates manifests, we have to put it directly to rancher mgmt cluster, so this provider connects to mgmt cluster
provider "kubectl" {
alias = "rancher_mgmt_cluster"
host = data.tfe_outputs.hcloud_main.nonsensitive_values.rancher_mgmt_cluster_host
client_certificate = data.tfe_outputs.hcloud_main.nonsensitive_values.rancher_mgmt_cluster_client_cert
client_key = data.tfe_outputs.hcloud_main.nonsensitive_values.rancher_mgmt_cluster_client_key
cluster_ca_certificate = data.tfe_outputs.hcloud_main.nonsensitive_values.rancher_mgmt_cluster_ca
load_config_file = false
apply_retry_count = 10
}