-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Ontotext-AD/TES-350-nats
TES-350: Added NAT gateway
- Loading branch information
Showing
9 changed files
with
122 additions
and
17 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
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,39 @@ | ||
locals { | ||
# Choose one of the zones for single zone NAT | ||
# TODO: Is it okay to take the first one ? | ||
nat_zone = var.zones[0] | ||
} | ||
|
||
resource "azurerm_public_ip" "graphdb-nat-ip-address" { | ||
name = "${var.resource_name_prefix}-nat-gateway" | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
|
||
sku = "Standard" | ||
allocation_method = "Static" | ||
zones = [local.nat_zone] | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_nat_gateway" "graphdb" { | ||
name = var.resource_name_prefix | ||
resource_group_name = var.resource_group_name | ||
location = var.location | ||
|
||
sku_name = "Standard" | ||
zones = [local.nat_zone] | ||
idle_timeout_in_minutes = 10 # TODO: 120 is the max in the portal, gotta test with long running request | ||
|
||
tags = var.tags | ||
} | ||
|
||
resource "azurerm_nat_gateway_public_ip_association" "graphdb-nat" { | ||
nat_gateway_id = azurerm_nat_gateway.graphdb.id | ||
public_ip_address_id = azurerm_public_ip.graphdb-nat-ip-address.id | ||
} | ||
|
||
resource "azurerm_subnet_nat_gateway_association" "graphdb-nat" { | ||
nat_gateway_id = azurerm_nat_gateway.graphdb.id | ||
subnet_id = var.nat_subnet_id | ||
} |
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,9 @@ | ||
output "nat_public_ip_address" { | ||
description = "The public IPv4 address for the NAT gateway" | ||
value = azurerm_public_ip.graphdb-nat-ip-address.ip_address | ||
} | ||
|
||
output "nat_public_ip_address_id" { | ||
description = "Identifier of the public IP address for the NAT gateway" | ||
value = azurerm_public_ip.graphdb-nat-ip-address.id | ||
} |
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,34 @@ | ||
# 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 "nat_subnet_id" { | ||
description = "Identifier of the subnet to which the NAT will be associated" | ||
type = 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.5.0" | ||
|
||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = ">=3.80.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
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