This repository has been archived on 2023-05-06. You can view files and clone it, but cannot push or open issues or pull requests.
helix/internal/docker/volume.go
Dan Anglin 2a761272a0
feat: create a shared volume
The shared volume will be used by each container
to share their specific traefik dynamic
configuration to allow Traefik to dynamically
configure the backend.
2021-07-11 13:39:58 +01:00

36 lines
708 B
Go

package docker
import (
"fmt"
"github.com/pulumi/pulumi-docker/sdk/v3/go/docker"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
type DockerVolumeInput struct {
Name pulumi.StringInput
UniqueLabel string
}
type DockerVolumeOutput struct {
Name pulumi.StringOutput
}
func CreateVolume(ctx *pulumi.Context, input DockerVolumeInput) (DockerVolumeOutput, error) {
var output DockerVolumeOutput
args := docker.VolumeArgs{
Name: input.Name,
}
volume, err := docker.NewVolume(ctx, input.UniqueLabel, &args)
if err != nil {
return output, fmt.Errorf("unable to create the %s volume...\n%v", input.UniqueLabel, err)
}
output = DockerVolumeOutput{
Name: volume.Name,
}
return output, nil
}