Skip to content

Instantly share code, notes, and snippets.

@lenadroid
Created February 23, 2018 21:33
Show Gist options
  • Save lenadroid/f0022ad3d7a656ac1e2cce87296d170f to your computer and use it in GitHub Desktop.
Save lenadroid/f0022ad3d7a656ac1e2cce87296d170f to your computer and use it in GitHub Desktop.
Managed Kubernetes Service Terraform
resource "azurerm_resource_group" "KubeTerraform" {
name = "${var.rg_name}"
location = "${var.region}"
}
resource "azurerm_kubernetes_cluster" "KubeTerraform" {
name = "${var.cluster_name}"
location = "${azurerm_resource_group.KubeTerraform.location}"
resource_group_name = "${azurerm_resource_group.KubeTerraform.name}"
kubernetes_version = "1.8.2"
dns_prefix = "aksdnsprfxtest"
linux_profile {
admin_username = "azureuser"
ssh_key {
key_data = "${var.ssh_key_data}"
}
}
agent_pool_profile {
name = "default"
count = 3
vm_size = "Standard_D2_v2"
os_type = "Linux"
}
service_principal {
client_id = "${var.service_principal_id}"
client_secret = "${var.service_principal_password}"
}
tags {
Environment = "Production"
}
}
service_principal_id=""
service_principal_password=""
ssh_key_data=""
rg_name=""
cluster_name=""
region=""
// General Variables
variable "service_principal_id" {
type = "string"
}
variable "service_principal_password" {
type = "string"
}
variable "ssh_key_data" {
type = "string"
}
variable "rg_name" {
type = "string"
}
variable "region" {
type = "string"
}
variable "cluster_name" {
type = "string"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment