christianlempa-boilerplates/terraform/templates/kubernetes-automation-example/provider.tf

77 lines
2.6 KiB
Terraform
Raw Normal View History

2022-03-17 13:09:48 +01:00
terraform {
required_version = ">= 0.13.0"
required_providers {
civo = {
source = "civo/civo"
version = "~> 1.0.13"
}
helm = {
source = "hashicorp/helm"
version = "2.12.1"
2022-03-17 13:09:48 +01:00
}
2022-04-01 09:25:19 +02:00
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.27.0"
2022-04-01 09:25:19 +02:00
}
2022-03-17 13:09:48 +01:00
kubectl = {
source = "gavinbunney/kubectl"
version = "1.14.0"
2022-03-17 13:09:48 +01:00
}
2022-04-01 09:25:19 +02:00
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 3.0"
}
2022-03-17 13:09:48 +01:00
}
}
2022-04-01 09:25:19 +02:00
variable "civo_token" {
type = string
2022-03-17 13:09:48 +01:00
}
2022-04-01 09:25:19 +02:00
variable "cloudflare_email" {
type = string
2022-03-17 13:09:48 +01:00
}
2022-04-01 09:25:19 +02:00
variable "cloudflare_api_key" {
type = string
}
provider "civo" {
token = var.civo_token
# TODO: (optional) change region to your desired datacenter location
# ---
# region = "FRA1"
2022-03-17 13:09:48 +01:00
}
provider "helm" {
kubernetes {
host = "${yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).clusters.0.cluster.server}"
client_certificate = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).users.0.user.client-certificate-data)}"
client_key = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).users.0.user.client-key-data)}"
2022-04-01 09:25:19 +02:00
cluster_ca_certificate ="${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).clusters.0.cluster.certificate-authority-data)}"
2022-03-17 13:09:48 +01:00
}
}
2022-04-01 09:25:19 +02:00
provider "kubernetes" {
host = "${yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).clusters.0.cluster.server}"
client_certificate = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).users.0.user.client-certificate-data)}"
client_key = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).users.0.user.client-key-data)}"
cluster_ca_certificate = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).clusters.0.cluster.certificate-authority-data)}"
}
2022-03-17 13:09:48 +01:00
provider "kubectl" {
host = "${yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).clusters.0.cluster.server}"
client_certificate = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).users.0.user.client-certificate-data)}"
client_key = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).users.0.user.client-key-data)}"
cluster_ca_certificate = "${base64decode(yamldecode(civo_kubernetes_cluster.k8s_demo_1.kubeconfig).clusters.0.cluster.certificate-authority-data)}"
load_config_file = false
2022-04-01 09:25:19 +02:00
}
provider "cloudflare" {
email = var.cloudflare_email
api_key = var.cloudflare_api_key
}