Skip to content

Commit a1a90fa

Browse files
Merge pull request #120 from pluralsh/improve-azure-setup
Smarter azure setup
2 parents a65b48f + 5c543ea commit a1a90fa

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

terraform/clouds/azure/locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
21
locals {
2+
network_name = var.network_name == "" ? "${var.cluster_name}-network" : var.network_name
33
resource_group = {
44
name = var.create_resource_group ? azurerm_resource_group.main[0].name : var.resource_group_name
55
location = var.location

terraform/clouds/azure/network.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
resource "azurerm_virtual_network" "network" {
22
address_space = var.network_cidrs
33
location = local.resource_group.location
4-
name = var.network_name
4+
name = local.network_name
55
resource_group_name = local.resource_group.name
66
}
77

88
resource "azurerm_subnet" "network" {
99
address_prefixes = var.subnet_cidrs
10-
name = "${var.network_name}-sn"
10+
name = "${local.network_name}-sn"
1111
resource_group_name = local.resource_group.name
1212
virtual_network_name = azurerm_virtual_network.network.name
1313
enforce_private_link_endpoint_network_policies = true
1414
}
1515

1616
resource "azurerm_subnet" "postgres" {
17-
name = "${var.network_name}-pg"
17+
name = "${local.network_name}-pg"
1818
resource_group_name = local.resource_group.name
1919
virtual_network_name = azurerm_virtual_network.network.name
2020
address_prefixes = var.postgres_cidrs

terraform/clouds/azure/postgres.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ resource "azurerm_private_dns_zone_virtual_network_link" "mysql" {
3131
resource "azurerm_private_dns_zone" "postgres" {
3232
count = var.create_db ? 1 : 0
3333

34-
name = var.postgres_dns_zone
34+
name = local.db_name
3535
resource_group_name = local.resource_group.name
3636
}
3737

terraform/clouds/azure/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ variable "location" {
4040

4141
variable "network_name" {
4242
type = string
43-
default = "plural"
43+
default = ""
4444
}
4545

4646
variable "network_cidrs" {

0 commit comments

Comments
 (0)