Package up swarm-exec
This commit is contained in:
parent
7ee91c0240
commit
ac1bf44562
3 changed files with 38 additions and 0 deletions
docker/swarm-exec
17
docker/swarm-exec/inputs.tf
Normal file
17
docker/swarm-exec/inputs.tf
Normal 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
|
||||||
|
}
|
10
docker/swarm-exec/swarm-exec.tf
Normal file
10
docker/swarm-exec/swarm-exec.tf
Normal 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]
|
||||||
|
}
|
11
docker/swarm-exec/terraform.tf
Normal file
11
docker/swarm-exec/terraform.tf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
terraform {
|
||||||
|
required_version = "~> 1.6"
|
||||||
|
required_providers {
|
||||||
|
docker = {
|
||||||
|
source = "kreuzwerker/docker"
|
||||||
|
version = "~>3.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue