Коммит
81df4affad
|
@ -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
|
||||
|
|
1
main.tf
1
main.tf
|
@ -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"
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче