-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30cf839
commit a118249
Showing
8 changed files
with
137 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# GraphDB NAT Module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
locals { | ||
# TODO: This module depends on both zones and subnet_ids... it could be misconfigured... | ||
# We could calculate the cidrs based on prefix & the zones | ||
# Convert the numbers to a set of strings | ||
zones = toset([for z in var.zones : format("%d", z)]) | ||
} | ||
|
||
resource "azurerm_public_ip" "graphdb-nat-ip-address" { | ||
for_each = local.zones | ||
|
||
name = "${var.resource_name_prefix}-nat-gateway-${each.key}" | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
|
||
sku = "Standard" | ||
allocation_method = "Static" | ||
zones = [each.value] | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_nat_gateway" "graphdb" { | ||
for_each = toset(local.zones) | ||
|
||
name = "${var.resource_name_prefix}-nat-${each.key}" | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
zones = [each.value] | ||
|
||
sku_name = "Standard" | ||
idle_timeout_in_minutes = 10 # TODO: ???? 120 is the max in the portal | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_nat_gateway_public_ip_association" "graphdb-nat" { | ||
count = length(azurerm_nat_gateway.graphdb) | ||
|
||
nat_gateway_id = azurerm_nat_gateway.graphdb[count.index + 1].id | ||
public_ip_address_id = azurerm_public_ip.graphdb-nat-ip-address[count.index + 1].id | ||
} | ||
|
||
resource "azurerm_subnet_nat_gateway_association" "graphdb-nat" { | ||
count = length(azurerm_nat_gateway.graphdb) | ||
|
||
nat_gateway_id = azurerm_nat_gateway.graphdb[count.index + 1].id | ||
subnet_id = var.nat_subnet_ids[count.index] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# General configurations | ||
|
||
variable "resource_name_prefix" { | ||
description = "Resource name prefix used for tagging and naming Azure resources" | ||
type = string | ||
} | ||
|
||
variable "location" { | ||
description = "Azure geographical location where resources will be deployed" | ||
type = string | ||
} | ||
|
||
variable "zones" { | ||
description = "Availability zones to use for resource deployment and HA" | ||
type = list(number) | ||
} | ||
|
||
variable "tags" { | ||
description = "Common resource tags." | ||
type = map(string) | ||
default = {} | ||
} | ||
|
||
variable "resource_group_name" { | ||
description = "Name of the resource group where GraphDB will be deployed." | ||
type = string | ||
} | ||
|
||
# Networking | ||
|
||
variable "network_interface_name" { | ||
description = "Network interface where GraphDB will be deployed" | ||
type = string | ||
} | ||
|
||
variable "nat_subnet_ids" { | ||
description = "Identifiers of the subnets to which the NATs will be associated" | ||
type = list(string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.3.1" | ||
|
||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">=3.71.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
output "public_address_fqdn" { | ||
description = "External FQDN address for GraphDB" | ||
value = module.address.public_ip_address_fqdn | ||
} | ||
#output "public_address_fqdn" { | ||
# description = "External FQDN address for GraphDB" | ||
# value = module.address.public_ip_address_fqdn | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters