Secret class

<!-- Bug: Type and Name are switched --> Manages the secrets of a Docker service in a swarm.

Example Usage

Basic

import * as pulumi from "@pulumi/pulumi";
import * as docker from "@pulumi/docker";
import * as std from "@pulumi/std";

const foo = new docker.Secret("foo", {
    name: "foo",
    data: std.base64encode({
        input: "{\"foo\": \"s3cr3t\"}",
    }).result,
});
import pulumi
import pulumi_docker as docker
import pulumi_std as std

foo = docker.Secret("foo",
    name="foo",
    data=std.base64encode(input="{\"foo\": \"s3cr3t\"}")["result"])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Docker = Pulumi.Docker;
using Std = Pulumi.Std;

return await Deployment.RunAsync(() =>
{
    var foo = new Docker.Secret("foo", new()
    {
        Name = "foo",
        Data = Std.Base64encode.Invoke(new()
        {
            Input = "{\"foo\": \"s3cr3t\"}",
        }).Result,
    });

});
package main

import (
	"github.com/pulumi/pulumi-docker/sdk/v5/go/docker"
	"github.com/pulumi/pulumi-std/sdk/go/std"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		invokeBase64encode, err := std.Base64encode(ctx, map[string]string{
			"input": "{\"foo\": \"s3cr3t\"}",
		}, nil)
		if err != nil {
			return err
		}
		_, err = docker.NewSecret(ctx, "foo", &docker.SecretArgs{
			Name: pulumi.String("foo"),
			Data: invokeBase64encode.Result,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    docker = {
      source = "pulumi/docker"
    }
  }
}

resource "docker_secret" "foo" {
  name = "foo"
  data = base64encode("{\"foo\": \"s3cr3t\"}")
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.docker.Secret;
import com.pulumi.docker.SecretArgs;
import com.pulumi.std.StdFunctions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var foo = new Secret("foo", SecretArgs.builder()
            .name("foo")
            .data(StdFunctions.base64encode(Map.of("input", "{\"foo\": \"s3cr3t\"}")).result())
            .build());

    }
}
resources:
  foo:
    type: docker:Secret
    properties:
      name: foo
      data:
        fn::invoke:
          function: std:base64encode
          arguments:
            input: '{"foo": "s3cr3t"}'
          return: result

Import

#!/bin/bash

# Docker secret cannot be imported as the secret data, once set, is never exposed again.

Constructors

Secret(String name, {SecretArgs? args, CustomResourceOptions? options})
Creates a new Secret. name The Pulumi resource name. args Arguments used to configure this Secret. The set of arguments for Secret. options Resource options controlling this resource's behavior.
Secret.reference(String urn)
Creates a typed reference to an existing Secret resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
data ↔ Output<String>
Base64-url-safe-encoded secret data
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
labels ↔ Output<List<SecretLabel>?>
User-defined key/value metadata
latefinal
name ↔ Output<String>
User-defined name of the secret
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {SecretState? state, CustomResourceOptions? options}) → Secret
Gets an existing Secret resource's state with the given name and id.