Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ resource "azurerm_kubernetes_cluster" "main" {
}
}

dynamic "microsoft_defender" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this block to line 144 please? We're sorting arguments(assignments with equal symbol) and blocks in resource block are sorted in the following order:

  • count and for_each
  • Required arguments in lexicographical order
  • Optional arguments in lexicographical order
  • Required blocks in lexicographical order
  • Optional blocks in lexicographical order
  • depends_on, then lifecycle

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gonna do this ra

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

for_each = var.microsoft_defender_enabled ? ["microsoft_defender"] : []

content {
log_analytics_workspace_id = var.log_analytics_workspace_id == null ? azurerm_log_analytics_workspace.main[0].id : var.log_analytics_workspace.id
}
}

lifecycle {
precondition {
condition = (var.client_id != "" && var.client_secret != "") || (var.identity_type != "")
Expand Down Expand Up @@ -204,4 +212,4 @@ resource "azurerm_log_analytics_solution" "main" {
product = "OMSGallery/ContainerInsights"
publisher = "Microsoft"
}
}
}
9 changes: 8 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -449,4 +449,11 @@ variable "vnet_subnet_id" {
type = string
description = "(Optional) The ID of a Subnet where the Kubernetes Node Pool should exist. Changing this forces a new resource to be created."
default = null
}
}

variable "microsoft_defender_enabled" {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this block to line 262 please? We are sorting variables in the following order:

  • Required variables in lexicographical order(variables without default value)
  • Optional variables in lexicographical order

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gonna do this ra

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

type = bool
description = "(Optional) Is Microsoft Defender on the cluster enabled?"
default = false
nullable = false
}