From 82b2a9f62bccc2ad408107bbe15f2b7e4adf5f46 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Wed, 11 Jun 2025 23:45:59 -0600 Subject: [PATCH 1/4] sample traffic manager --- 3_networking/traffic-manager/README.md | 67 +++++++++++++++++++ 3_networking/traffic-manager/main.tf | 28 ++++++++ 3_networking/traffic-manager/outputs.tf | 12 ++++ 3_networking/traffic-manager/provider.tf | 19 ++++++ 3_networking/traffic-manager/terraform.tfvars | 19 ++++++ 3_networking/traffic-manager/variables.tf | 57 ++++++++++++++++ 6 files changed, 202 insertions(+) create mode 100644 3_networking/traffic-manager/README.md create mode 100644 3_networking/traffic-manager/main.tf create mode 100644 3_networking/traffic-manager/outputs.tf create mode 100644 3_networking/traffic-manager/provider.tf create mode 100644 3_networking/traffic-manager/terraform.tfvars create mode 100644 3_networking/traffic-manager/variables.tf diff --git a/3_networking/traffic-manager/README.md b/3_networking/traffic-manager/README.md new file mode 100644 index 0000000..530e84f --- /dev/null +++ b/3_networking/traffic-manager/README.md @@ -0,0 +1,67 @@ +# Terraform Template - Azure Traffic Manager + +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 Traffic Manager profile, including DNS configuration and endpoint monitoring. + +> [!NOTE] +> This Traffic Manager configuration uses best practices for routing, monitoring, and DNS setup. + +

+ image +

+ +## File Descriptions + +- **main.tf**: Contains the main configuration for creating the Azure Traffic Manager profile and its associated resources. +- **variables.tf**: Defines the input variables used in the Terraform configuration. +- **provider.tf**: Configures the Azure provider to interact with Azure resources. +- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`. +- **outputs.tf**: Defines the outputs such as Traffic Manager profile ID and FQDN. + +## Variables + +Below is a list of variables used in this template, their expected values, types, and examples: + +| Variable Name | Description | Type | Example Value | +|------------------------ |-------------------------------------------------------|--------------|----------------------| +| `resource_group_name` | The name of the resource group | string | `"tm-resource-group"` | +| `location` | The Azure region for the resource group | string | `"eastus"` | +| `traffic_manager_name` | The name of the Traffic Manager profile | string | `"my-tm-profile"` | +| `traffic_routing_method`| The traffic routing method (Performance, Priority, etc.) | string | `"Performance"` | +| `dns_name` | The relative DNS name for the Traffic Manager profile | string | `"mytmprofile"` | +| `ttl` | The DNS Time-To-Live (TTL) in seconds | number | `30` | +| `monitor_protocol` | The protocol used for endpoint monitoring | string | `"HTTP"` | +| `monitor_port` | The port used for endpoint monitoring | number | `80` | +| `monitor_path` | The path used for endpoint monitoring | string | `"/"` | + +## Usage + +1. Clone the repository and navigate to the traffic-manager 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 | +|----------------------------|---------------------------------------------| +| `traffic_manager_profile_id` | The ID of the Traffic Manager profile | +| `traffic_manager_fqdn` | The FQDN of the Traffic Manager profile | + +
+

Total Visitors

+ Visitor Count +
diff --git a/3_networking/traffic-manager/main.tf b/3_networking/traffic-manager/main.tf new file mode 100644 index 0000000..9351aea --- /dev/null +++ b/3_networking/traffic-manager/main.tf @@ -0,0 +1,28 @@ +# main.tf +# This file contains the main configuration for creating an Azure Traffic Manager profile. + +# Resource Group +resource "azurerm_resource_group" "tm" { + name = var.resource_group_name + location = var.location +} + +# Traffic Manager Profile +resource "azurerm_traffic_manager_profile" "tm" { + name = var.traffic_manager_name + resource_group_name = azurerm_resource_group.tm.name + traffic_routing_method = var.traffic_routing_method + + dns_config { + relative_name = var.dns_name + ttl = var.ttl + } + + monitor_config { + protocol = var.monitor_protocol + port = var.monitor_port + path = var.monitor_path + } + + # Add endpoints as needed using azurerm_traffic_manager_endpoint resources +} \ No newline at end of file diff --git a/3_networking/traffic-manager/outputs.tf b/3_networking/traffic-manager/outputs.tf new file mode 100644 index 0000000..39e2c72 --- /dev/null +++ b/3_networking/traffic-manager/outputs.tf @@ -0,0 +1,12 @@ +# outputs.tf +# This file defines the outputs for the Traffic Manager configuration. + +output "traffic_manager_profile_id" { + description = "The ID of the Traffic Manager profile" + value = azurerm_traffic_manager_profile.tm.id +} + +output "traffic_manager_fqdn" { + description = "The FQDN of the Traffic Manager profile" + value = azurerm_traffic_manager_profile.tm.fqdn +} \ No newline at end of file diff --git a/3_networking/traffic-manager/provider.tf b/3_networking/traffic-manager/provider.tf new file mode 100644 index 0000000..f3f9b2d --- /dev/null +++ b/3_networking/traffic-manager/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/traffic-manager/terraform.tfvars b/3_networking/traffic-manager/terraform.tfvars new file mode 100644 index 0000000..4c3f2fa --- /dev/null +++ b/3_networking/traffic-manager/terraform.tfvars @@ -0,0 +1,19 @@ +# 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 = "407f4106-0fd3-42e0-9348-3686dd1e7347" # your-subscription-id + +# Resource Group +resource_group_name = "RG-trafficmanager-test" # your-resource-group-name +location = "eastus" + +# Traffic Manager Configuration +traffic_manager_name = "my-tm-profile" +traffic_routing_method = "Performance" +dns_name = "mytmprofilebrowntest" +ttl = 30 +monitor_protocol = "HTTP" +monitor_port = 80 +monitor_path = "/" diff --git a/3_networking/traffic-manager/variables.tf b/3_networking/traffic-manager/variables.tf new file mode 100644 index 0000000..b659d8c --- /dev/null +++ b/3_networking/traffic-manager/variables.tf @@ -0,0 +1,57 @@ +# 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 for the resource group" + type = string +} + +variable "traffic_manager_name" { + description = "The name of the Traffic Manager profile" + type = string +} + +variable "traffic_routing_method" { + description = "The traffic routing method (e.g., Performance, Priority, Weighted, Geographic, MultiValue, Subnet)" + type = string + default = "Performance" +} + +variable "dns_name" { + description = "The relative DNS name for the Traffic Manager profile" + type = string +} + +variable "ttl" { + description = "The DNS Time-To-Live (TTL) in seconds" + type = number + default = 30 +} + +variable "monitor_protocol" { + description = "The protocol used for endpoint monitoring (HTTP, HTTPS, TCP)" + type = string + default = "HTTP" +} + +variable "monitor_port" { + description = "The port used for endpoint monitoring" + type = number + default = 80 +} + +variable "monitor_path" { + description = "The path used for endpoint monitoring" + type = string + default = "/" +} From e679306f5874ca2974344b57f01bdfb832e3b6f0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 12 Jun 2025 05:46:14 +0000 Subject: [PATCH 2/4] Update last modified date in Markdown files --- 3_networking/traffic-manager/README.md | 134 ++++++++++++------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/3_networking/traffic-manager/README.md b/3_networking/traffic-manager/README.md index 530e84f..4fb4d52 100644 --- a/3_networking/traffic-manager/README.md +++ b/3_networking/traffic-manager/README.md @@ -1,67 +1,67 @@ -# Terraform Template - Azure Traffic Manager - -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 Traffic Manager profile, including DNS configuration and endpoint monitoring. - -> [!NOTE] -> This Traffic Manager configuration uses best practices for routing, monitoring, and DNS setup. - -

- image -

- -## File Descriptions - -- **main.tf**: Contains the main configuration for creating the Azure Traffic Manager profile and its associated resources. -- **variables.tf**: Defines the input variables used in the Terraform configuration. -- **provider.tf**: Configures the Azure provider to interact with Azure resources. -- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`. -- **outputs.tf**: Defines the outputs such as Traffic Manager profile ID and FQDN. - -## Variables - -Below is a list of variables used in this template, their expected values, types, and examples: - -| Variable Name | Description | Type | Example Value | -|------------------------ |-------------------------------------------------------|--------------|----------------------| -| `resource_group_name` | The name of the resource group | string | `"tm-resource-group"` | -| `location` | The Azure region for the resource group | string | `"eastus"` | -| `traffic_manager_name` | The name of the Traffic Manager profile | string | `"my-tm-profile"` | -| `traffic_routing_method`| The traffic routing method (Performance, Priority, etc.) | string | `"Performance"` | -| `dns_name` | The relative DNS name for the Traffic Manager profile | string | `"mytmprofile"` | -| `ttl` | The DNS Time-To-Live (TTL) in seconds | number | `30` | -| `monitor_protocol` | The protocol used for endpoint monitoring | string | `"HTTP"` | -| `monitor_port` | The port used for endpoint monitoring | number | `80` | -| `monitor_path` | The path used for endpoint monitoring | string | `"/"` | - -## Usage - -1. Clone the repository and navigate to the traffic-manager 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 | -|----------------------------|---------------------------------------------| -| `traffic_manager_profile_id` | The ID of the Traffic Manager profile | -| `traffic_manager_fqdn` | The FQDN of the Traffic Manager profile | - -
-

Total Visitors

- Visitor Count -
+# Terraform Template - Azure Traffic Manager + +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 + +---------- + +> This template contains Terraform configurations to create and manage an Azure Traffic Manager profile, including DNS configuration and endpoint monitoring. + +> [!NOTE] +> This Traffic Manager configuration uses best practices for routing, monitoring, and DNS setup. + +

+ image +

+ +## File Descriptions + +- **main.tf**: Contains the main configuration for creating the Azure Traffic Manager profile and its associated resources. +- **variables.tf**: Defines the input variables used in the Terraform configuration. +- **provider.tf**: Configures the Azure provider to interact with Azure resources. +- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`. +- **outputs.tf**: Defines the outputs such as Traffic Manager profile ID and FQDN. + +## Variables + +Below is a list of variables used in this template, their expected values, types, and examples: + +| Variable Name | Description | Type | Example Value | +|------------------------ |-------------------------------------------------------|--------------|----------------------| +| `resource_group_name` | The name of the resource group | string | `"tm-resource-group"` | +| `location` | The Azure region for the resource group | string | `"eastus"` | +| `traffic_manager_name` | The name of the Traffic Manager profile | string | `"my-tm-profile"` | +| `traffic_routing_method`| The traffic routing method (Performance, Priority, etc.) | string | `"Performance"` | +| `dns_name` | The relative DNS name for the Traffic Manager profile | string | `"mytmprofile"` | +| `ttl` | The DNS Time-To-Live (TTL) in seconds | number | `30` | +| `monitor_protocol` | The protocol used for endpoint monitoring | string | `"HTTP"` | +| `monitor_port` | The port used for endpoint monitoring | number | `80` | +| `monitor_path` | The path used for endpoint monitoring | string | `"/"` | + +## Usage + +1. Clone the repository and navigate to the traffic-manager 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 | +|----------------------------|---------------------------------------------| +| `traffic_manager_profile_id` | The ID of the Traffic Manager profile | +| `traffic_manager_fqdn` | The FQDN of the Traffic Manager profile | + +
+

Total Visitors

+ Visitor Count +
From c95e5f9717f55b150549d4fb103f5d7b8836dd10 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Wed, 11 Jun 2025 23:47:08 -0600 Subject: [PATCH 3/4] visual ref --- 3_networking/traffic-manager/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3_networking/traffic-manager/README.md b/3_networking/traffic-manager/README.md index 4fb4d52..a707dad 100644 --- a/3_networking/traffic-manager/README.md +++ b/3_networking/traffic-manager/README.md @@ -15,7 +15,7 @@ Last updated: 2025-06-12 > This Traffic Manager configuration uses best practices for routing, monitoring, and DNS setup.

- image + image

## File Descriptions From 1e3032f5056c93ec1e76efe8aaa6740615b180d2 Mon Sep 17 00:00:00 2001 From: Timna Brown <24630902+brown9804@users.noreply.github.com> Date: Wed, 11 Jun 2025 23:47:43 -0600 Subject: [PATCH 4/4] sample --- 3_networking/traffic-manager/terraform.tfvars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3_networking/traffic-manager/terraform.tfvars b/3_networking/traffic-manager/terraform.tfvars index 4c3f2fa..ea982be 100644 --- a/3_networking/traffic-manager/terraform.tfvars +++ b/3_networking/traffic-manager/terraform.tfvars @@ -3,7 +3,7 @@ # These values can be overridden by specifying different values during Terraform execution. # Azure Subscription -subscription_id = "407f4106-0fd3-42e0-9348-3686dd1e7347" # your-subscription-id +subscription_id = "" # your-subscription-id # Resource Group resource_group_name = "RG-trafficmanager-test" # your-resource-group-name