Skip to content

Commit

Permalink
Add Virtual WAN module (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
frasdav authored Jan 8, 2024
1 parent 7e9ff74 commit e7a5d23
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/virtual-wan/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
29 changes: 29 additions & 0 deletions modules/virtual-wan/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Virtual WAN

This module creates a [Virtual WAN](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_wan).

## Usage

```hcl
module "virtual_wan" {
source = "https://github.com/gofrontier-com/azurerm-terraform-modules/releases/download/virtual-wan/[VERSION]/module.tar.gz//src"
environment = "con"
identifier = "main"
location = "uksouth"
resource_group_name = module.resource_group.name
zone = "pla"
tags = {
WorkloadType = "PlatformLZ/virtual-wan"
}
}
```

## Known issues

_None._

## Contributing

See <https://github.com/gofrontier-com/azurerm-terraform-modules/blob/main/README.rst#contributing>.
1 change: 1 addition & 0 deletions modules/virtual-wan/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0
14 changes: 14 additions & 0 deletions modules/virtual-wan/src/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
locals {
identifier = replace(lower(var.identifier), "/[^a-z1-9]/", "")

short_locations = {
"uksouth" = "uks"
"ukwest" = "ukw"
}

tags = {
Environment = var.environment
Location = var.location
Zone = var.zone
}
}
7 changes: 7 additions & 0 deletions modules/virtual-wan/src/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource "azurerm_virtual_wan" "main" {
name = "vwan-${var.zone}-${var.environment}-${lookup(local.short_locations, var.location)}-${local.identifier}"
resource_group_name = var.resource_group_name
location = var.location

tags = merge(var.tags, local.tags)
}
7 changes: 7 additions & 0 deletions modules/virtual-wan/src/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
output "id" {
value = azurerm_virtual_wan.main.id
}

output "name" {
value = azurerm_virtual_wan.main.name
}
24 changes: 24 additions & 0 deletions modules/virtual-wan/src/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
variable "environment" {
type = string
}

variable "identifier" {
type = string
}

variable "location" {
type = string
}

variable "resource_group_name" {
type = string
}

variable "tags" {
type = map(string)
default = {}
}

variable "zone" {
type = string
}
17 changes: 17 additions & 0 deletions modules/virtual-wan/test/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
provider "azurerm" {
features {}
}

module "virtual_wan" {
source = "../src"

environment = "bar"
identifier = "baz"
location = "uksouth"
resource_group_name = "baz"
zone = "bat"

tags = {
Foo = "Bar"
}
}
10 changes: 10 additions & 0 deletions modules/virtual-wan/test/terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = "~> 1.5"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.85"
}
}
}

0 comments on commit e7a5d23

Please sign in to comment.