Skip to content

Commit 19e9924

Browse files
authored
Merge pull request #603 from DeviaVir/main
resource_group: remove data source + location required
2 parents 10a8fd6 + dc6f475 commit 19e9924

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

log_analytics.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
resource "azurerm_log_analytics_workspace" "main" {
22
count = local.create_analytics_workspace ? 1 : 0
33

4-
location = coalesce(var.location, data.azurerm_resource_group.main.location)
4+
location = var.location
55
name = coalesce(var.cluster_log_analytics_workspace_name, trim("${var.prefix}-workspace", "-"))
66
resource_group_name = coalesce(var.log_analytics_workspace_resource_group_name, var.resource_group_name)
77
allow_resource_only_permissions = var.log_analytics_workspace_allow_resource_only_permissions

main.tf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
data "azurerm_resource_group" "main" {
2-
name = var.resource_group_name
3-
}
4-
51
moved {
62
from = module.ssh-key.tls_private_key.ssh
73
to = tls_private_key.ssh[0]
@@ -15,9 +11,9 @@ resource "tls_private_key" "ssh" {
1511
}
1612

1713
resource "azurerm_kubernetes_cluster" "main" {
18-
location = coalesce(var.location, data.azurerm_resource_group.main.location)
14+
location = var.location
1915
name = "${local.cluster_name}${var.cluster_name_random_suffix ? substr(md5(uuid()), 0, 4) : ""}"
20-
resource_group_name = data.azurerm_resource_group.main.name
16+
resource_group_name = var.resource_group_name
2117
azure_policy_enabled = var.azure_policy_enabled
2218
cost_analysis_enabled = var.cost_analysis_enabled
2319
disk_encryption_set_id = var.disk_encryption_set_id

variables.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variable "resource_group_name" {
22
type = string
3-
description = "The resource group name to be imported"
3+
description = "The existing resource group name to use"
44
}
55

66
variable "aci_connector_linux_enabled" {
@@ -671,7 +671,6 @@ variable "local_account_disabled" {
671671

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

0 commit comments

Comments
 (0)