Skip to content

Commit

Permalink
Merge pull request #1971 from sunu/feat/terraform-refactoring
Browse files Browse the repository at this point in the history
Save disk config in a k8s configmap
  • Loading branch information
szabozoltan69 authored Dec 7, 2023
2 parents 4b8e250 + 6573339 commit 0f460e8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
24 changes: 24 additions & 0 deletions deploy/terraform/resources/aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,27 @@ resource "azurerm_role_assignment" "storage" {
role_definition_name = "Storage Account Contributor"
principal_id = azurerm_kubernetes_cluster.ifrcgo.identity[0].principal_id
}

# create k8s configmaps and secrets

provider "kubernetes" {
host = azurerm_kubernetes_cluster.ifrcgo.kube_config.0.host
client_certificate = base64decode(azurerm_kubernetes_cluster.ifrcgo.kube_config.0.client_certificate)
client_key = base64decode(azurerm_kubernetes_cluster.ifrcgo.kube_config.0.client_key)
cluster_ca_certificate = base64decode(azurerm_kubernetes_cluster.ifrcgo.kube_config.0.cluster_ca_certificate)
}

resource "kubernetes_config_map" "ifrcgo_elasticsearch_disk_config" {
metadata {
name = "ifrcgo-elasticsearch-disk-config"
}

depends_on = [
azurerm_managed_disk.ifrcgo
]

data = {
"name" = "${local.prefix}-disk"
"uri" = azurerm_managed_disk.ifrcgo.id
}
}
4 changes: 4 additions & 0 deletions deploy/terraform/resources/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,9 @@ terraform {
source = "hashicorp/helm"
version = "=2.5.1"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "=2.24.0"
}
}
}

0 comments on commit 0f460e8

Please sign in to comment.