-
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.
refactor: Improve organization of Azure Route Table module
- Loading branch information
Showing
8 changed files
with
119 additions
and
80 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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "3.3.0" | ||
source = "hashicorp/azurerm" | ||
version = "3.94.0" | ||
} | ||
} | ||
required_version = ">= 0.15" | ||
required_version = ">= 1.6.4" | ||
} |
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,24 +1,70 @@ | ||
# Terraform Module for Azure Route Table | ||
# Terraform Module: Azure Route Table | ||
|
||
Terraform module for management Azure Route Tables wchich allow you to create network routes. | ||
This Terraform module creates an Azure Route Table with dynamic route entries. | ||
|
||
# How to use | ||
``` | ||
module "route-table" { | ||
source = "spy86/route-table/azure" | ||
version = "1.0.3" | ||
name = "dev-routetable" | ||
## Features | ||
|
||
- **Dynamic Route Entries:** Define dynamic route entries as a list of objects, each representing a route with a name, address prefix, next hop type, and optional next hop IP address. | ||
|
||
- **Tagging:** Automatically tags the created resources with common tags for better organization and management. | ||
|
||
- **BGP Route Propagation:** Option to disable propagation of routes learned by BGP on the route table. | ||
|
||
## Usage | ||
|
||
### Example | ||
|
||
```hcl | ||
provider "azurerm" { | ||
features {} | ||
} | ||
module "route_table" { | ||
source = "Think-Cube/route-table/azure" | ||
version = "1.0.0" | ||
route_table_name = "routetable" | ||
resource_group_name = "weu-test-rg" | ||
resource_group_location = "West Europe" | ||
environment = "dev" | ||
region = "weu" | ||
routes = [ | ||
route_table = [ | ||
{ name = "Route-01", address_prefix = "10.10.0.0/16", next_hop_type = "VirtualAppliance", next_hop_in_ip_address = "10.0.0.12" }, | ||
{ name = "Route-02", address_prefix = "10.20.0.0/16", next_hop_type = "VirtualAppliance", next_hop_in_ip_address = "10.0.0.16" }, | ||
{ name = "Route-03", address_prefix = "0.0.0.0/0", next_hop_type = "Internet" } | ||
] | ||
route_table_disable_bgp_route_propagation = "true" | ||
default_tags = { | ||
Administrator = "John Doe" | ||
Department = "IT" | ||
CostCentre = "CC123" | ||
ContactPerson = "Jane Smith" | ||
ManagedByTerraform = "True" | ||
} | ||
} | ||
``` | ||
|
||
More info You can find in [README.md](https://github.com/spy86/terraform-azure-route-table/blob/main/README.md) | ||
### Variables | ||
|
||
- `environment`: Variable that defines the name of the environment. | ||
- `default_tags`: A mapping of tags to assign to the resource. | ||
- `region`: Region in which resources are deployed. | ||
- `resource_group_location`: Specifies the supported Azure location where the resource exists. | ||
- `resource_group_name`: The name of the resource group in which to create the route table. | ||
- `route_table`: The name of the route table. | ||
- `route_table_disable_bgp_route_propagation`: Boolean flag to control propagation of routes learned by BGP on that route table. | ||
|
||
### Outputs | ||
|
||
- `route_table_id`: The Route Table ID. | ||
- `route_table_name`: The name of the route table. | ||
- `route_entries`: Objects representing routes. | ||
- `location`: Azure location where the resource exists. | ||
- `resource_group_name`: The name of the resource group in which the route table was created. | ||
|
||
## License | ||
|
||
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). | ||
|
||
## Contribution | ||
|
||
Feel free to contribute by opening issues or pull requests. Your feedback and improvements are highly appreciated! |
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,5 +1,5 @@ | ||
data "azurerm_client_config" "current" {} | ||
|
||
data "azurerm_resource_group" "rg" { | ||
name = "${var.resource_group_name}" | ||
data "azurerm_resource_group" "main" { | ||
name = var.resource_group_name | ||
} |
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,34 +1,29 @@ | ||
output "id" { | ||
value = "${azurerm_route_table.routetable.id}" | ||
output "route_table_id" { | ||
description = "The Route Table ID." | ||
value = azurerm_route_table.main.id | ||
sensitive = false | ||
} | ||
|
||
output "name" { | ||
value = "${azurerm_route_table.routetable.name}" | ||
output "route_table_name" { | ||
description = "The name of the route table." | ||
value = azurerm_route_table.main.name | ||
sensitive = false | ||
} | ||
|
||
output "resource_group_name" { | ||
value = "${azurerm_route_table.routetable.resource_group_name}" | ||
description = "The name of the resource group in which to create the route table." | ||
output "route_entries" { | ||
description = "Objects representing routes" | ||
value = azurerm_route_table.main.route[*].name | ||
sensitive = false | ||
} | ||
|
||
output "location" { | ||
value = "${azurerm_route_table.routetable.location}" | ||
description = "Azure location where where the route table is created." | ||
} | ||
|
||
output "routes" { | ||
value = "${azurerm_route_table.routetable.route}" | ||
description = "List of objects representing routes." | ||
description = "Azure location where the resource exists." | ||
value = azurerm_route_table.main.location | ||
sensitive = false | ||
} | ||
|
||
output "subnets" { | ||
value = "${azurerm_route_table.routetable.subnets}" | ||
description = "The collection of Subnets associated with this route table." | ||
output "resource_group_name" { | ||
description = "The name of the resource group in which to create the route table" | ||
value = azurerm_route_table.main.resource_group_name | ||
sensitive = false | ||
} | ||
|
||
output "tags" { | ||
value = "${azurerm_route_table.routetable.tags}" | ||
description = "A mapping of tags to assign to the resource." | ||
} |
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