Skip to content

seven_router (Resource)#

Network router configuration

Example Usage#

# SPDX-License-Identifier: EUPL-1.2
terraform {
  required_providers {
    seven = {
      source = "terraform.scl.example/seven/infrastructure"
    }
  }
}

provider "seven" {
  # example configuration here
}

# To continue successfully, the separation context must already exist and be valid.
# Otherwise, contact the operator to create and provide one.
variable "sc_name" {
  type = string
  description = "The name of a separation context allocated to a tenant of SCL resources (must exist and be known)."
  default = "b"
}

resource "seven_router" "my_router" {
  name                = "b-router-01"
  # use data dependency to make sure the context is created before the VM
  separation_context  = var.sc_name
  external_ip         = "192.168.168.2"
  internal_ip         = "192.168.10.1"
  internal_ip_netmask = "255.255.255.0"
  forward_tcp_port {
    src_port = 2222
    dst_ip   = "192.168.10.2"
    dst_port = 22
  }
  forward_tcp_port {
    src_port = 3333
    dst_ip   = "192.168.10.2"
    dst_port = 4444
  }
  forward_udp_port {
     src_port = 3333
     dst_ip   = "192.168.10.2"
     dst_port = 4444
   }
}

output "example_context" {
  value = var.sc_name
}

output "example_router" {
  value = resource.seven_router.my_router
}

Schema#

Required#

  • external_ip (String) External IPv4 address.
  • internal_ip (String) Internal IPv4 address within the SC internal network.
  • internal_ip_netmask (String) IPv4 network address mask of the SC internal network.
  • name (String) Unique, immutable name of the Router within the Separation Context.
  • separation_context (String) The name of the Separation Context containing this Router.

Optional#

  • forward_tcp_port (Block List) Maps ports associated with the external_ip to a user specified internal dst_ip:dst_port. (see below for nested schema)
  • forward_udp_port (Block List) Maps ports associated with the external_ip to a user specified internal dst_ip:dst_port. (see below for nested schema)

Read-Only#

  • id (String) The ID of this resource.

Nested Schema for forward_tcp_port#

Required:

  • dst_ip (String) The destination IPv4 address to forward traffic to.
  • dst_port (Number) The destination port to forward traffic to.
  • src_port (Number) The source port associated with the external IP.

Nested Schema for forward_udp_port#

Required:

  • dst_ip (String) The destination IPv4 address to forward traffic to.
  • dst_port (Number) The destination port to forward traffic to.
  • src_port (Number) The source port associated with the external IP.