Skip to content

Commit

Permalink
resource_group_location default empty (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: Hangyu Xu <[email protected]>
  • Loading branch information
xhy8759 and Hangyu Xu authored Oct 11, 2024
1 parent 37b0390 commit 084d09f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ Description: The resource id of resource group.

Type: `string`

### <a name="input_resource_group_location"></a> [resource\_group\_location](#input\_resource\_group\_location)

Description: The location of resource group.

Type: `string`

### <a name="input_servers"></a> [servers](#input\_servers)

Description: A list of servers with their names and IPv4 addresses.
Expand Down Expand Up @@ -664,6 +658,14 @@ Type: `string`

Default: `"RoCEv2"`

### <a name="input_resource_group_location"></a> [resource\_group\_location](#input\_resource\_group\_location)

Description: The location of resource group.

Type: `string`

Default: `""`

### <a name="input_role_assignments"></a> [role\_assignments](#input\_role\_assignments)

Description: A map of role assignments to create on this resource. The map key is deliberately arbitrary to avoid issues where map keys maybe unknown at plan time.
Expand Down
2 changes: 1 addition & 1 deletion keyvault.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ data "azurerm_client_config" "current" {}
resource "azurerm_key_vault" "deployment_keyvault" {
count = var.create_key_vault ? 1 : 0

location = var.key_vault_location == "" ? var.resource_group_location : var.key_vault_location
location = var.key_vault_location == "" ? local.resource_group_location : var.key_vault_location
name = var.random_suffix ? "${var.keyvault_name}-${random_integer.random_suffix.result}" : var.keyvault_name
resource_group_name = local.resource_group_name
sku_name = "standard"
Expand Down
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ locals {
networkDirect = "Enabled"
networkDirectTechnology = var.rdma_protocol
}
resource_group_location = var.resource_group_location == "" ? var.location : var.resource_group_location
# The resource group name is the last element of the split result
resource_group_name = element(local.resource_group_parts, length(local.resource_group_parts) - 1)
# Split the resource group ID into parts based on '/'
Expand Down
2 changes: 1 addition & 1 deletion storageaccount.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resource "azurerm_storage_account" "witness" {

account_replication_type = var.account_replication_type
account_tier = "Standard"
location = var.resource_group_location
location = local.resource_group_location
name = var.random_suffix ? "${var.witness_storage_account_name}${random_integer.random_suffix.result}" : var.witness_storage_account_name
resource_group_name = local.witness_storage_account_resource_group_name
allow_nested_items_to_be_public = var.allow_nested_items_to_be_public
Expand Down
11 changes: 6 additions & 5 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ variable "resource_group_id" {
description = "The resource id of resource group."
}

variable "resource_group_location" {
type = string
description = "The location of resource group."
}

variable "servers" {
type = list(object({
name = string
Expand Down Expand Up @@ -489,6 +484,12 @@ variable "rdma_protocol" {
description = "The RDMA protocol."
}

variable "resource_group_location" {
type = string
default = ""
description = "The location of resource group."
}

variable "role_assignments" {
type = map(object({
role_definition_id_or_name = string
Expand Down

0 comments on commit 084d09f

Please sign in to comment.