Skip to content

Commit

Permalink
resource_group: remove data_source + location required
Browse files Browse the repository at this point in the history
  • Loading branch information
DeviaVir committed Dec 2, 2024
1 parent 9087737 commit 2db2506
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion log_analytics.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "azurerm_log_analytics_workspace" "main" {
count = local.create_analytics_workspace ? 1 : 0

location = coalesce(var.location, data.azurerm_resource_group.main.location)
location = var.location
name = coalesce(var.cluster_log_analytics_workspace_name, trim("${var.prefix}-workspace", "-"))
resource_group_name = coalesce(var.log_analytics_workspace_resource_group_name, var.resource_group_name)
allow_resource_only_permissions = var.log_analytics_workspace_allow_resource_only_permissions
Expand Down
8 changes: 2 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
data "azurerm_resource_group" "main" {
name = var.resource_group_name
}

moved {
from = module.ssh-key.tls_private_key.ssh
to = tls_private_key.ssh[0]
Expand All @@ -15,9 +11,9 @@ resource "tls_private_key" "ssh" {
}

resource "azurerm_kubernetes_cluster" "main" {
location = coalesce(var.location, data.azurerm_resource_group.main.location)
location = var.location
name = "${local.cluster_name}${var.cluster_name_random_suffix ? substr(md5(uuid()), 0, 4) : ""}"
resource_group_name = data.azurerm_resource_group.main.name
resource_group_name = var.resource_group_name
automatic_channel_upgrade = var.automatic_channel_upgrade
azure_policy_enabled = var.azure_policy_enabled
cost_analysis_enabled = var.cost_analysis_enabled
Expand Down
3 changes: 1 addition & 2 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "resource_group_name" {
type = string
description = "The resource group name to be imported"
description = "The existing resource group name to use"
}

variable "aci_connector_linux_enabled" {
Expand Down Expand Up @@ -670,7 +670,6 @@ variable "local_account_disabled" {

variable "location" {
type = string
default = null
description = "Location of cluster, if not defined it will be read from the resource-group"
}

Expand Down

0 comments on commit 2db2506

Please sign in to comment.