Merge pull request #24 from jungopro/master

added kubeconfig output
This commit is contained in:
Malte Lantin 2020-01-20 14:03:24 +01:00 коммит произвёл GitHub
Родитель c323fd3b26 83fb9e8aad
Коммит 81df4affad
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 25 добавлений и 0 удалений

Просмотреть файл

@ -13,6 +13,7 @@ module "aks" {
CLIENT_ID = "your-service-principal-client-appid"
CLIENT_SECRET = "your-service-principal-client-password"
prefix = "your-custom-resource-prefix"
kubeconfig_path = "/home/user/.kube/mycluster.yaml"
}
```
@ -72,6 +73,10 @@ variable "public_ssh_key" {
description = "A custom ssh key to control access to the AKS cluster"
default = ""
}
variable "kubeconfig_path" {
description = "full path to save the kubeconfig in (e.g. /root/.kube/mycluster.yaml). make sure to add this file to KUBECONFIG (e.g. export KUBECONFIG=$KUBECONFIG:/root/.kube/mycluster.yaml) in order to add it to your list of clusters"
}
```
The module supports some outputs that may be used to configure a kubernetes

Просмотреть файл

@ -21,6 +21,7 @@ module "kubernetes" {
service_principal_client_id = var.CLIENT_ID
service_principal_client_secret = var.CLIENT_SECRET
log_analytics_workspace_id = module.log_analytics_workspace.id
kubeconfig_path = var.kubeconfig_path
}
module "log_analytics_workspace" {

Просмотреть файл

@ -0,0 +1,12 @@
data "template_file" "kubeconfig" {
template = file("${path.module}/templates/kubeconfig.tpl")
vars = {
data = azurerm_kubernetes_cluster.main.kube_config_raw
}
}
resource "local_file" "kubeconfig" {
content = data.template_file.kubeconfig.rendered
filename = var.kubeconfig_path
}

Просмотреть файл

@ -0,0 +1 @@
${data}

Просмотреть файл

@ -49,3 +49,6 @@ variable "service_principal_client_secret" {
description = "The Client Secret of the Service Principal assigned to Kubernetes"
}
variable "kubeconfig_path" {
description = "full path to save the kubeconfig in (e.g. /root/.kube/mycluster.yaml). make sure to add this file to KUBECONFIG (e.g. export KUBECONFIG=$KUBECONFIG:/root/.kube/mycluster.yaml) in order to add it to your list of clusters"
}

Просмотреть файл

@ -50,3 +50,6 @@ variable "public_ssh_key" {
default = ""
}
variable "kubeconfig_path" {
description = "full path to save the kubeconfig in (e.g. /root/.kube/mycluster.yaml). make sure to add this file to KUBECONFIG (e.g. export KUBECONFIG=$KUBECONFIG:/root/.kube/mycluster.yaml) in order to add it to your list of clusters"
}