add stubs for iperf and http2https

This commit is contained in:
Greyscale 2025-01-29 19:20:47 +01:00
parent e63eedc370
commit 1b6cbe880c
Signed by: grey
GPG key ID: DDB392AE64B32D89
8 changed files with 182 additions and 0 deletions

View file

@ -0,0 +1,10 @@
module "service" {
source = "../../docker/service"
image = "${var.http2https_image}:${var.http2https_version}"
stack_name = var.stack_name
service_name = var.service_name
networks = var.networks
converge_enable = false # @todo MB: fix healthcheck and fix this.
ports = var.ports
placement_constraints = var.placement_constraints
}

View file

@ -0,0 +1,53 @@
variable "http2https_image" {
default = "articulate/http-to-https"
type = string
description = "The docker image to use for the MemcacheD service."
}
variable "http2https_version" {
default = "latest"
type = string
description = "The version of the docker image to use for the MemcacheD service."
}
# Pass-thru variables
variable "stack_name" {
type = string
}
variable "service_name" {
default = "iperf3"
type = string
description = "The name of the service to create."
}
variable "networks" {
type = list(object({
name = string
id = string
}))
default = []
description = "A list of network names to attach the service to."
}
variable "ports" {
type = list(object({
host = optional(number)
container = number
protocol = optional(string, "tcp")
}))
default = []
description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."
validation {
error_message = "Host Ports must be between 1 and 65535 or null."
condition = alltrue([for port in var.ports : port.host == null ? true : (port.host >= 1 && port.host <= 65535)])
}
validation {
error_message = "Container Ports must be between 1 and 65535."
condition = alltrue([for port in var.ports : port.container >= 1 && port.container <= 65535])
}
validation {
error_message = "Protocol must be either 'tcp' or 'udp'."
condition = alltrue([for port in var.ports : port.protocol == "tcp" || port.protocol == "udp"])
}
}
variable "placement_constraints" {
default = []
type = list(string)
description = "Docker Swarm placement constraints"
}

View file

@ -0,0 +1,12 @@
output "service_name" {
value = module.service.service_name
}
output "ports" {
value = module.service.ports
}
output "docker_service" {
value = module.service.docker_service
}
output "endpoint" {
value = "tcp://${module.service.service_name}:5201/"
}

View file

@ -0,0 +1,16 @@
terraform {
required_version = "~> 1.6"
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.5"
}
}
}

53
products/iperf/inputs.tf Normal file
View file

@ -0,0 +1,53 @@
variable "iperf_image" {
default = "loganmarchione/docker-iperf3"
type = string
description = "The docker image to use for the MemcacheD service."
}
variable "iperf_version" {
default = "latest"
type = string
description = "The version of the docker image to use for the MemcacheD service."
}
# Pass-thru variables
variable "stack_name" {
type = string
}
variable "service_name" {
default = "http2https"
type = string
description = "The name of the service to create."
}
variable "networks" {
type = list(object({
name = string
id = string
}))
default = []
description = "A list of network names to attach the service to."
}
variable "ports" {
type = list(object({
host = optional(number)
container = number
protocol = optional(string, "tcp")
}))
default = []
description = "A map of port mappings to expose on the host. The key is the host port, and the value is the container port."
validation {
error_message = "Host Ports must be between 1 and 65535 or null."
condition = alltrue([for port in var.ports : port.host == null ? true : (port.host >= 1 && port.host <= 65535)])
}
validation {
error_message = "Container Ports must be between 1 and 65535."
condition = alltrue([for port in var.ports : port.container >= 1 && port.container <= 65535])
}
validation {
error_message = "Protocol must be either 'tcp' or 'udp'."
condition = alltrue([for port in var.ports : port.protocol == "tcp" || port.protocol == "udp"])
}
}
variable "placement_constraints" {
default = []
type = list(string)
description = "Docker Swarm placement constraints"
}

10
products/iperf/iperf.tf Normal file
View file

@ -0,0 +1,10 @@
module "service" {
source = "../../docker/service"
image = "${var.iperf_image}:${var.iperf_version}"
stack_name = var.stack_name
service_name = var.service_name
networks = var.networks
converge_enable = false # @todo MB: fix healthcheck and fix this.
ports = var.ports
placement_constraints = var.placement_constraints
}

12
products/iperf/outputs.tf Normal file
View file

@ -0,0 +1,12 @@
output "service_name" {
value = module.service.service_name
}
output "ports" {
value = module.service.ports
}
output "docker_service" {
value = module.service.docker_service
}
output "endpoint" {
value = "tcp://${module.service.service_name}:5201/"
}

View file

@ -0,0 +1,16 @@
terraform {
required_version = "~> 1.6"
required_providers {
docker = {
source = "kreuzwerker/docker"
version = "~>3.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.5"
}
}
}