Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage static addresses used for GRE #18

Merged
merged 1 commit into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions import-dnat.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {
to = module.device["R9"].netbox_ip_address.gre_dnat
id = 261
}

import {
to = module.device["R10"].netbox_ip_address.gre_dnat
id = 294
}

import {
to = module.device["R14"].netbox_ip_address.gre_dnat
id = 331
}

import {
to = module.device["R15"].netbox_ip_address.gre_dnat
id = 559
}

import {
to = module.device["R18"].netbox_ip_address.gre_dnat
id = 643
}

import {
to = module.device["R19"].netbox_ip_address.gre_dnat
id = 512
}

import {
to = module.device["R20"].netbox_ip_address.gre_dnat
id = 727
}
6 changes: 6 additions & 0 deletions modules/device/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,9 @@ variable "tenant_id" {
description = "NetBox tenant ID to use for all resources"
default = 1
}

variable "gre_dnat_ip" {
type = string
description = "Private IP addressed used to receive GRE packets from the CPE"
default = "192.168.178.10/24"
}
20 changes: 20 additions & 0 deletions modules/device/wan.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
data "netbox_device_interfaces" "wan" {
filter {
name = "device_id"
value = var.device_id
}

filter {
name = "name"
value = "eth2"
}
}

resource "netbox_ip_address" "gre_dnat" {
vrf_id = netbox_vrf.local.id
ip_address = var.gre_dnat_ip
status = "active"
device_interface_id = one(data.netbox_device_interfaces.wan.interfaces).id

description = "Static Uplink IP (for GRE forwarding) on ${local.location}"
}