Skip to content

Commit

Permalink
rollup to azurerm 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin-DynamicD committed Mar 25, 2022
1 parent b677834 commit ff39bdc
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 14 deletions.
2 changes: 1 addition & 1 deletion agw.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "azurerm_public_ip" "main" {
location = local.global_settings.location
allocation_method = "Static"
sku = "Standard"
availability_zone = "Zone-Redundant"
zones = local.zones != [] ? local.zones : null
tags = var.tags
}

Expand Down
6 changes: 3 additions & 3 deletions aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ resource "azurerm_kubernetes_cluster" "main" {
os_disk_size_gb = local.aks.os_disk_size_gb
os_disk_type = local.aks.os_disk_type
vnet_subnet_id = local.aks.subnet_id
availability_zones = local.zones != [] ? local.zones : null
zones = local.zones != [] ? local.zones : null
tags = local.tags
}
identity {
type = "UserAssigned"
user_assigned_identity_id = azurerm_user_assigned_identity.main.id
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.main.id]
}
network_profile {
network_plugin = "azure"
Expand Down
4 changes: 2 additions & 2 deletions identity.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ resource "azurerm_role_assignment" "agwaks" {
count = local.app_gateway.enabled ? 1 : 0
scope = azurerm_application_gateway.main[0].id
role_definition_name = "Contributor"
principal_id = azurerm_kubernetes_cluster.main.addon_profile[0].ingress_application_gateway[0].ingress_application_gateway_identity[0].object_id
principal_id = azurerm_kubernetes_cluster.main.ingress_application_gateway[0].ingress_application_gateway_identity[0].object_id
}

resource "azurerm_role_assignment" "agwaksrg" {
count = local.app_gateway.enabled ? 1 : 0
scope = data.azurerm_resource_group.source.id
role_definition_name = "Reader"
principal_id = azurerm_kubernetes_cluster.main.addon_profile[0].ingress_application_gateway[0].ingress_application_gateway_identity[0].object_id
principal_id = azurerm_kubernetes_cluster.main.ingress_application_gateway[0].ingress_application_gateway_identity[0].object_id
}
21 changes: 16 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ locals {
automatic_channel_upgrade = ""
azure_policy = true
docker_bridge_cidr = "172.17.0.1/16"
max_count = 3
min_count = 1
max_count = 4
min_count = 3
name = ""
node_count = 2
os_disk_size_gb = 128
node_count = 3
os_disk_size_gb = 70
os_disk_type = "Ephemeral"
sku_tier = "Free"
vm_size = "Standard_DS3_v2"
vm_size = "Standard_D2ds_v5"
})
app_gateway = defaults(var.app_gateway, {
enabled = false
Expand All @@ -29,6 +29,17 @@ locals {
global_settings = defaults(var.global_settings, {
name_prefix = "aks-baseline"
})
# node_pools = defaults(var.node_pools, {
# {
# enable_auto_scaling = true
# max_count = 4
# min_count = 3
# node_count = 3
# os_disk_size_gb = 70
# os_disk_type = "Ephemeral"
# vm_size = "Standard_D2ds_v5"
# }
# })
oms = defaults(var.oms, {
enabled = false
storage_account_id = ""
Expand Down
2 changes: 0 additions & 2 deletions test/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ module "aks" {
resource_group_name = azurerm_resource_group.test.name
}
aks = {
os_disk_size_gb = 70
subnet_id = module.myvnet.vnet_subnets["aks_nodes"].id
vm_size = "Standard_D2ds_v5"
}
app_gateway = {
enabled = true
Expand Down
15 changes: 15 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ variable aks {
description = "map of all aks variables"
}

variable node_pools {
type = map(object({
vm_size = string
enable_auto_scaling = optional(bool)
max_count = optional(number)
min_count = optional(number)
node_count = optional(number)
os_disk_size_gb = optional(number)
os_disk_type = optional(string)
vm_size = optional(string)
}))
description = "map of node pools for aks to create"
default = {}
}

variable oms {
type = object({
enabled = optional(bool)
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ terraform {
required_version = ">= 1.0.0"
experiments = [module_variable_optional_attrs]
required_providers {
azurerm = ">= 2.90"
azurerm = ">= 3.0.1"
#azuread = ">= 1.0.0"
}
}

0 comments on commit ff39bdc

Please sign in to comment.