From cf360a0e5529cf7d4db65a42b68b920b04118af0 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 12 Jun 2025 14:41:38 -0600 Subject: [PATCH 1/8] vpn-gatway sample --- 3_networking/vpn-gateway/README.md | 61 ++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 3_networking/vpn-gateway/README.md diff --git a/3_networking/vpn-gateway/README.md b/3_networking/vpn-gateway/README.md new file mode 100644 index 0000000..dad4b83 --- /dev/null +++ b/3_networking/vpn-gateway/README.md @@ -0,0 +1,61 @@ +# Terraform Template - Azure VPN Gateway + +Costa Rica + +[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) +[brown9804](https://github.com/brown9804) + +Last updated: 2025-06-11 + +---------- + +> This template contains Terraform configurations to create and manage an Azure VPN Gateway, including a virtual network, GatewaySubnet, and public IP. + +> [!NOTE] +> The subnet used for Azure VPN Gateway **must** be named `GatewaySubnet` and sized at least /27. + +

+ image +

+ +## File Descriptions + +- **main.tf**: Contains the main configuration for creating the Azure VPN Gateway and its supporting resources. +- **variables.tf**: Defines the input variables used in the Terraform configuration. +- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`. +- **outputs.tf**: Defines the outputs such as VPN Gateway ID and public IP address. + +## Variables + +| Variable Name | Description | Type | Example Value | +|---------------------- |--------------------------------------------------|--------|-----------------------------| +| `subscription_id` | The Azure subscription ID | string | `"00000000-0000-0000-0000-000000000000"` | +| `resource_group_name` | The name of the resource group | string | `"my-vpngw-rg"` | +| `location` | The Azure region to deploy resources | string | `"eastus"` | +| `public_ip_name` | The name of the public IP address for the VPN Gateway | string | `"my-vpngw-pip"` | +| `vpn_gateway_name` | The name of the VPN Gateway | string | `"my-vpngw"` | +| `vpn_gateway_sku` | The SKU for the VPN Gateway | string | `"VpnGw1"` | + +## Usage + +1. Clone the repository and navigate to the vpn-gateway directory. +2. Update the `terraform.tfvars` file with your values. +3. Initialize and apply the Terraform configuration: + +```bash +terraform init +terraform plan +terraform apply +``` + +## Outputs + +| Output Name | Description | +|-----------------------|---------------------------------------------| +| `vpn_gateway_id` | The ID of the VPN Gateway | +| `vpn_gateway_public_ip` | The public IP address of the VPN Gateway | + +
+

Total Visitors

+ Visitor Count +
From 42cdbf3ef65d0aa0d964eff5eac829b799c5c212 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Jun 2025 20:41:56 +0000 Subject: [PATCH 2/8] Update last modified date in Markdown files --- 3_networking/vpn-gateway/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3_networking/vpn-gateway/README.md b/3_networking/vpn-gateway/README.md index dad4b83..2ee8a2b 100644 --- a/3_networking/vpn-gateway/README.md +++ b/3_networking/vpn-gateway/README.md @@ -5,7 +5,7 @@ Costa Rica [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2025-06-11 +Last updated: 2025-06-12 ---------- From b751ed17a8dd73c19498c51eb356f7abb39cf399 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 12 Jun 2025 14:46:17 -0600 Subject: [PATCH 3/8] title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 81d8822..649ec05 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Azure Terraform Sample Templates: Version 0.0.0 +# Azure Terraform Deployment
Sample Templates: Version 0.0.0 Costa Rica From 44e3f9e353434249535636266e9502c2375c675b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Jun 2025 20:46:28 +0000 Subject: [PATCH 4/8] Update last modified date in Markdown files --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 649ec05..f94cd2e 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Costa Rica [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2025-06-01 +Last updated: 2025-06-12 ---------- From 661c2311225fb5792ae9a3f93f51bd8f1c4f40c0 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 12 Jun 2025 14:52:47 -0600 Subject: [PATCH 5/8] content networking --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index f94cd2e..13d26d4 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,20 @@ Last updated: 2025-06-12 +
+ Networking (Click to expand) + +- [Networking](./3_networking) + - [Azure Application Gateway](./3_networking/application-gateway) + - [Azure ExpressRoute](./3_networking/expressroute) + - [Azure Firewall](./3_networking/firewall) + - [Azure Front Door](./3_networking/front-door) + - [Azure Load Balancer](./3_networking/load-balancer) + - [Azure Traffic Manager](./3_networking/traffic-manager) + - [Azure VPN Gateway](./3_networking/vpn-gateway) + +
+ ## Prerequisites From 23a20da08727c02a737efaa982a4995c762385db Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 12 Jun 2025 18:02:07 -0600 Subject: [PATCH 6/8] visual ref --- 3_networking/vpn-gateway/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3_networking/vpn-gateway/README.md b/3_networking/vpn-gateway/README.md index 2ee8a2b..9dc0217 100644 --- a/3_networking/vpn-gateway/README.md +++ b/3_networking/vpn-gateway/README.md @@ -15,7 +15,7 @@ Last updated: 2025-06-12 > The subnet used for Azure VPN Gateway **must** be named `GatewaySubnet` and sized at least /27.

- image + image

## File Descriptions From 6ffe1b2946b786135b0b7d161a64986de37f5343 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 13 Jun 2025 00:02:18 +0000 Subject: [PATCH 7/8] Update last modified date in Markdown files --- 3_networking/vpn-gateway/README.md | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/3_networking/vpn-gateway/README.md b/3_networking/vpn-gateway/README.md index 9dc0217..6b98157 100644 --- a/3_networking/vpn-gateway/README.md +++ b/3_networking/vpn-gateway/README.md @@ -5,7 +5,7 @@ Costa Rica [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2025-06-12 +Last updated: 2025-06-13 ---------- diff --git a/README.md b/README.md index 13d26d4..f78df0b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Costa Rica [![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/) [brown9804](https://github.com/brown9804) -Last updated: 2025-06-12 +Last updated: 2025-06-13 ---------- From cff98d6f8d13fd9a7fb73bf5f96d190cca7311c8 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Thu, 12 Jun 2025 18:03:01 -0600 Subject: [PATCH 8/8] sample template for vpn gateway --- 3_networking/vpn-gateway/main.tf | 52 +++++++++++++++++++++++ 3_networking/vpn-gateway/outputs.tf | 12 ++++++ 3_networking/vpn-gateway/provider.tf | 19 +++++++++ 3_networking/vpn-gateway/terraform.tfvars | 15 +++++++ 3_networking/vpn-gateway/variables.tf | 33 ++++++++++++++ 5 files changed, 131 insertions(+) create mode 100644 3_networking/vpn-gateway/main.tf create mode 100644 3_networking/vpn-gateway/outputs.tf create mode 100644 3_networking/vpn-gateway/provider.tf create mode 100644 3_networking/vpn-gateway/terraform.tfvars create mode 100644 3_networking/vpn-gateway/variables.tf diff --git a/3_networking/vpn-gateway/main.tf b/3_networking/vpn-gateway/main.tf new file mode 100644 index 0000000..c8dc20d --- /dev/null +++ b/3_networking/vpn-gateway/main.tf @@ -0,0 +1,52 @@ +# main.tf +# This file contains the main configuration for creating an Azure VPN Gateway and its supporting resources. + +# Resource Group +resource "azurerm_resource_group" "vpngw" { + name = var.resource_group_name + location = var.location +} + +# Virtual Network for VPN Gateway +resource "azurerm_virtual_network" "vpngw" { + name = "vpngw-vnet" + address_space = ["10.10.0.0/16"] + location = azurerm_resource_group.vpngw.location + resource_group_name = azurerm_resource_group.vpngw.name +} + +# GatewaySubnet (required name and at least /27) +resource "azurerm_subnet" "gateway" { + name = "GatewaySubnet" + resource_group_name = azurerm_resource_group.vpngw.name + virtual_network_name = azurerm_virtual_network.vpngw.name + address_prefixes = ["10.10.1.0/27"] +} + +# Public IP for VPN Gateway +resource "azurerm_public_ip" "vpngw" { + name = var.public_ip_name + location = azurerm_resource_group.vpngw.location + resource_group_name = azurerm_resource_group.vpngw.name + allocation_method = "Static" # <-- Must be Static for Standard SKU + sku = "Standard" +} + +# VPN Gateway +resource "azurerm_virtual_network_gateway" "vpngw" { + name = var.vpn_gateway_name + location = azurerm_resource_group.vpngw.location + resource_group_name = azurerm_resource_group.vpngw.name + type = "Vpn" + vpn_type = "RouteBased" + active_active = false + enable_bgp = false + sku = var.vpn_gateway_sku + + ip_configuration { + name = "vnetGatewayConfig" + public_ip_address_id = azurerm_public_ip.vpngw.id + subnet_id = azurerm_subnet.gateway.id + private_ip_address_allocation = "Dynamic" + } +} \ No newline at end of file diff --git a/3_networking/vpn-gateway/outputs.tf b/3_networking/vpn-gateway/outputs.tf new file mode 100644 index 0000000..eb70811 --- /dev/null +++ b/3_networking/vpn-gateway/outputs.tf @@ -0,0 +1,12 @@ +# outputs.tf +# This file defines the outputs for the VPN Gateway configuration. + +output "vpn_gateway_id" { + description = "The ID of the VPN Gateway" + value = azurerm_virtual_network_gateway.vpngw.id +} + +output "vpn_gateway_public_ip" { + description = "The public IP address of the VPN Gateway" + value = azurerm_public_ip.vpngw.ip_address +} diff --git a/3_networking/vpn-gateway/provider.tf b/3_networking/vpn-gateway/provider.tf new file mode 100644 index 0000000..f3f9b2d --- /dev/null +++ b/3_networking/vpn-gateway/provider.tf @@ -0,0 +1,19 @@ +# provider.tf +# This file configures the Azure provider to interact with Azure resources. +# It specifies the required provider and its version, along with provider-specific configurations. + +terraform { + required_version = ">= 1.8, < 2.0" + # Specify the required provider and its version + required_providers { + azurerm = { + source = "hashicorp/azurerm" # Source of the AzureRM provider + version = "~> 4.16.0" # Version of the AzureRM provider + } + } +} + +provider "azurerm" { + features {} # Enable all features for the AzureRM provider + subscription_id = var.subscription_id # Use the subscription ID variable +} diff --git a/3_networking/vpn-gateway/terraform.tfvars b/3_networking/vpn-gateway/terraform.tfvars new file mode 100644 index 0000000..f768b04 --- /dev/null +++ b/3_networking/vpn-gateway/terraform.tfvars @@ -0,0 +1,15 @@ +# terraform.tfvars +# This file provides default values for the variables defined in variables.tf. +# These values can be overridden by specifying different values during Terraform execution. + +# Azure Subscription +subscription_id = "" # "your-subscription-id" + +# Resource Group +resource_group_name = "RG-vpn-gateway-test" +location = "eastus" + +# VPN Gateway Configuration +public_ip_name = "my-vpngw-pip" +vpn_gateway_name = "my-vpngw" +vpn_gateway_sku = "VpnGw1" \ No newline at end of file diff --git a/3_networking/vpn-gateway/variables.tf b/3_networking/vpn-gateway/variables.tf new file mode 100644 index 0000000..d51db88 --- /dev/null +++ b/3_networking/vpn-gateway/variables.tf @@ -0,0 +1,33 @@ +# variables.tf +# This file defines the input variables used in the Terraform configuration. + +variable "subscription_id" { + description = "The Azure subscription ID" + type = string +} + +variable "resource_group_name" { + description = "The name of the resource group" + type = string +} + +variable "location" { + description = "The Azure region to deploy resources" + type = string +} + +variable "public_ip_name" { + description = "The name of the public IP address for the VPN Gateway" + type = string +} + +variable "vpn_gateway_name" { + description = "The name of the VPN Gateway" + type = string +} + +variable "vpn_gateway_sku" { + description = "The SKU for the VPN Gateway (e.g., VpnGw1, VpnGw2)" + type = string + default = "VpnGw1" +}