Dan Anglin
2a761272a0
The shared volume will be used by each container to share their specific traefik dynamic configuration to allow Traefik to dynamically configure the backend.
36 lines
708 B
Go
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
|
|
}
|