Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin-DynamicD committed Apr 1, 2022
1 parent 89dbf50 commit 83670e5
Showing 1 changed file with 64 additions and 14 deletions.
78 changes: 64 additions & 14 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,52 @@
provider azurerm {
features{}
features {
resource_group {
prevent_deletion_if_contains_resources = false # only good for demo, remove in prod
}
}
}

resource azurerm_resource_group "main" {
name = "test-aks-baseline"
name = "basic-aks-baseline"
location = "westus2"
}

# oms resources to connect to
resource "azurerm_log_analytics_workspace" "main" {
name = "basic-aks-la"
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
sku = "PerGB2018"
}

resource "random_string" "nameSuffix" {
length = 8
special = false
upper = false
}

resource "azurerm_storage_account" "main" {
name = "basicaks${random_string.nameSuffix.result}" # keeps the global name unique to avoid collisions
resource_group_name = azurerm_resource_group.main.name
location = azurerm_resource_group.main.location
account_tier = "Standard"
account_replication_type = "RAGRS"
allow_nested_items_to_be_public = true
}

resource "azurerm_log_analytics_solution" "containerinsights" {
solution_name = "ContainerInsights"
location = azurerm_log_analytics_workspace.main.location
resource_group_name = azurerm_resource_group.main.name
workspace_resource_id = azurerm_log_analytics_workspace.main.id
workspace_name = azurerm_log_analytics_workspace.main.name
plan {
publisher = "Microsoft"
product = "OMSGallery/ContainerInsights"
}
}

# network to run on
module "myvnet" {
source = "Justin-DynamicD/virtual_network/azurerm"
global_settings = {
Expand All @@ -24,22 +64,32 @@ module "myvnet" {
}

module "aks" {
source = "../"
source = "Justin-DynamicD/aks_baseline/azurerm"
depends_on = [
azurerm_resource_group.test
azurerm_resource_group.main,
azurerm_log_analytics_workspace.main,
azurerm_storage_account.main,
azurerm_log_analytics_solution.containerinsights
]
global_settings = {
location = azurerm_resource_group.main.location
name_prefix = "testaks"
resource_group_name = azurerm_resource_group.main.name
}
aks = {
os_disk_size_gb = 70
subnet_id = module.myvnet.vnet_subnets["aks_nodes"].id
vm_size = "Standard_D2ds_v5"
}
location = azurerm_resource_group.main.location
name_prefix = "basicaks"
resource_group_name = azurerm_resource_group.main.name
subnet_id = module.myvnet.vnet_subnets["aks_nodes"].id
app_gateway = {
enabled = true
subnet_id = module.myvnet.vnet_subnets["agw"].id
}
node_default_pool = {
min_count = 1
node_count = 1
}
node_user_pool = {
min_count = 1
node_count = 1
}
oms = {
enabled = true
storage_account_id = azurerm_storage_account.main.id
workspace_id = azurerm_log_analytics_workspace.main.id
}
}

0 comments on commit 83670e5

Please sign in to comment.