Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource_group: remove data source + location required #603

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
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