Package up swarm-exec

This commit is contained in:
Greyscale 2025-01-06 16:28:12 +01:00
parent 7ee91c0240
commit ac1bf44562
Signed by: grey
GPG key ID: DDB392AE64B32D89
3 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,17 @@
variable "command" {
type = string
description = "The command to run in the container."
}
variable "image" {
type = string
description = "The docker image to use for the swarm-exec service."
default = "mavenugo/swarm-exec:17.03.0-ce"
}
variable "stack_name" {
description = "The name of the collective stack"
type = string
}
variable "service_name" {
description = "The name of the service"
type = string
}

View file

@ -0,0 +1,10 @@
module "swarm_exec" {
source = "../service"
image = var.image
stack_name = var.stack_name
service_name = var.service_name
mounts = { "/var/run/docker.sock" = "/var/run/docker.sock" }
global = true
one_shot = true
command = ["sh", "-c", var.command]
}

View file

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