Skip to content

Commit

Permalink
feat: update azure tf provider template (#987)
Browse files Browse the repository at this point in the history
Signed-off-by: David van der Spek <[email protected]>
  • Loading branch information
davidspek authored Mar 7, 2023
1 parent 75a699e commit 9750cb6
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions apps/core/priv/scaffolds/terraform/providers/0.1.3/azure.eex
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
terraform {
backend "azurerm" {
storage_account_name = {{ .Values.Context.StorageAccount | quote }}
resource_group_name = {{ .Values.ResourceGroup | quote }}
container_name = {{ .Values.Bucket | quote }}
key = "{{ .Values.__CLUSTER__ }}/{{ .Values.Prefix }}/terraform.tfstate"
}

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.46.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 2.18.1"
}
}
}

provider "azurerm" {
features {}
}

{{ if .Values.ClusterCreated }}
provider "kubernetes" {
host = {{ .Values.Cluster }}.host
client_certificate = base64decode({{ .Values.Cluster }}.client_certificate)
client_key = base64decode({{ .Values.Cluster }}.client_key)
cluster_ca_certificate = base64decode({{ .Values.Cluster }}.cluster_ca_certificate)
}
{{ else }}
data "azurerm_kubernetes_cluster" "cluster" {
name = {{ .Values.Cluster }}
resource_group_name = {{ .Values.ResourceGroup | quote }}
}

provider "kubernetes" {
host = data.azurerm_kubernetes_cluster.cluster.kube_config[0].host
client_certificate = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].client_certificate)
client_key = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].client_key)
cluster_ca_certificate = base64decode(data.azurerm_kubernetes_cluster.cluster.kube_config[0].cluster_ca_certificate)
}
{{ end }}

0 comments on commit 9750cb6

Please sign in to comment.