1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. secretmanager
  5. Secret
Google Cloud v8.25.1 published on Wednesday, Apr 9, 2025 by Pulumi

gcp.secretmanager.Secret

Explore with Pulumi AI

A Secret is a logical secret whose value and versions can be accessed.

To get more information about Secret, see:

Example Usage

Secret Config Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
    secretId: "secret",
    labels: {
        label: "my-label",
    },
    replication: {
        userManaged: {
            replicas: [
                {
                    location: "us-central1",
                },
                {
                    location: "us-east1",
                },
            ],
        },
    },
});
Copy
import pulumi
import pulumi_gcp as gcp

secret_basic = gcp.secretmanager.Secret("secret-basic",
    secret_id="secret",
    labels={
        "label": "my-label",
    },
    replication={
        "user_managed": {
            "replicas": [
                {
                    "location": "us-central1",
                },
                {
                    "location": "us-east1",
                },
            ],
        },
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/secretmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret"),
			Labels: pulumi.StringMap{
				"label": pulumi.String("my-label"),
			},
			Replication: &secretmanager.SecretReplicationArgs{
				UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
					Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
						&secretmanager.SecretReplicationUserManagedReplicaArgs{
							Location: pulumi.String("us-central1"),
						},
						&secretmanager.SecretReplicationUserManagedReplicaArgs{
							Location: pulumi.String("us-east1"),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var secret_basic = new Gcp.SecretManager.Secret("secret-basic", new()
    {
        SecretId = "secret",
        Labels = 
        {
            { "label", "my-label" },
        },
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            UserManaged = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedArgs
            {
                Replicas = new[]
                {
                    new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
                    {
                        Location = "us-central1",
                    },
                    new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
                    {
                        Location = "us-east1",
                    },
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.secretmanager.Secret;
import com.pulumi.gcp.secretmanager.SecretArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationUserManagedArgs;
import java.util.List;
import java.util.ArrayList;
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 secret_basic = new Secret("secret-basic", SecretArgs.builder()
            .secretId("secret")
            .labels(Map.of("label", "my-label"))
            .replication(SecretReplicationArgs.builder()
                .userManaged(SecretReplicationUserManagedArgs.builder()
                    .replicas(                    
                        SecretReplicationUserManagedReplicaArgs.builder()
                            .location("us-central1")
                            .build(),
                        SecretReplicationUserManagedReplicaArgs.builder()
                            .location("us-east1")
                            .build())
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  secret-basic:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret
      labels:
        label: my-label
      replication:
        userManaged:
          replicas:
            - location: us-central1
            - location: us-east1
Copy

Secret With Annotations

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const secret_with_annotations = new gcp.secretmanager.Secret("secret-with-annotations", {
    secretId: "secret",
    labels: {
        label: "my-label",
    },
    annotations: {
        key1: "someval",
        key2: "someval2",
        key3: "someval3",
        key4: "someval4",
        key5: "someval5",
    },
    replication: {
        auto: {},
    },
});
Copy
import pulumi
import pulumi_gcp as gcp

secret_with_annotations = gcp.secretmanager.Secret("secret-with-annotations",
    secret_id="secret",
    labels={
        "label": "my-label",
    },
    annotations={
        "key1": "someval",
        "key2": "someval2",
        "key3": "someval3",
        "key4": "someval4",
        "key5": "someval5",
    },
    replication={
        "auto": {},
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/secretmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretmanager.NewSecret(ctx, "secret-with-annotations", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret"),
			Labels: pulumi.StringMap{
				"label": pulumi.String("my-label"),
			},
			Annotations: pulumi.StringMap{
				"key1": pulumi.String("someval"),
				"key2": pulumi.String("someval2"),
				"key3": pulumi.String("someval3"),
				"key4": pulumi.String("someval4"),
				"key5": pulumi.String("someval5"),
			},
			Replication: &secretmanager.SecretReplicationArgs{
				Auto: &secretmanager.SecretReplicationAutoArgs{},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var secret_with_annotations = new Gcp.SecretManager.Secret("secret-with-annotations", new()
    {
        SecretId = "secret",
        Labels = 
        {
            { "label", "my-label" },
        },
        Annotations = 
        {
            { "key1", "someval" },
            { "key2", "someval2" },
            { "key3", "someval3" },
            { "key4", "someval4" },
            { "key5", "someval5" },
        },
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            Auto = null,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.secretmanager.Secret;
import com.pulumi.gcp.secretmanager.SecretArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
import java.util.List;
import java.util.ArrayList;
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 secret_with_annotations = new Secret("secret-with-annotations", SecretArgs.builder()
            .secretId("secret")
            .labels(Map.of("label", "my-label"))
            .annotations(Map.ofEntries(
                Map.entry("key1", "someval"),
                Map.entry("key2", "someval2"),
                Map.entry("key3", "someval3"),
                Map.entry("key4", "someval4"),
                Map.entry("key5", "someval5")
            ))
            .replication(SecretReplicationArgs.builder()
                .auto(SecretReplicationAutoArgs.builder()
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  secret-with-annotations:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret
      labels:
        label: my-label
      annotations:
        key1: someval
        key2: someval2
        key3: someval3
        key4: someval4
        key5: someval5
      replication:
        auto: {}
Copy

Secret With Version Destroy Ttl

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const secret_with_version_destroy_ttl = new gcp.secretmanager.Secret("secret-with-version-destroy-ttl", {
    secretId: "secret",
    versionDestroyTtl: "2592000s",
    replication: {
        auto: {},
    },
});
Copy
import pulumi
import pulumi_gcp as gcp

secret_with_version_destroy_ttl = gcp.secretmanager.Secret("secret-with-version-destroy-ttl",
    secret_id="secret",
    version_destroy_ttl="2592000s",
    replication={
        "auto": {},
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/secretmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := secretmanager.NewSecret(ctx, "secret-with-version-destroy-ttl", &secretmanager.SecretArgs{
			SecretId:          pulumi.String("secret"),
			VersionDestroyTtl: pulumi.String("2592000s"),
			Replication: &secretmanager.SecretReplicationArgs{
				Auto: &secretmanager.SecretReplicationAutoArgs{},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var secret_with_version_destroy_ttl = new Gcp.SecretManager.Secret("secret-with-version-destroy-ttl", new()
    {
        SecretId = "secret",
        VersionDestroyTtl = "2592000s",
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            Auto = null,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.secretmanager.Secret;
import com.pulumi.gcp.secretmanager.SecretArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
import java.util.List;
import java.util.ArrayList;
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 secret_with_version_destroy_ttl = new Secret("secret-with-version-destroy-ttl", SecretArgs.builder()
            .secretId("secret")
            .versionDestroyTtl("2592000s")
            .replication(SecretReplicationArgs.builder()
                .auto(SecretReplicationAutoArgs.builder()
                    .build())
                .build())
            .build());

    }
}
Copy
resources:
  secret-with-version-destroy-ttl:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret
      versionDestroyTtl: 2592000s
      replication:
        auto: {}
Copy

Secret With Automatic Cmek

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const project = gcp.organizations.getProject({});
const kms_secret_binding = new gcp.kms.CryptoKeyIAMMember("kms-secret-binding", {
    cryptoKeyId: "kms-key",
    role: "roles/cloudkms.cryptoKeyEncrypterDecrypter",
    member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-secretmanager.iam.gserviceaccount.com`),
});
const secret_with_automatic_cmek = new gcp.secretmanager.Secret("secret-with-automatic-cmek", {
    secretId: "secret",
    replication: {
        auto: {
            customerManagedEncryption: {
                kmsKeyName: "kms-key",
            },
        },
    },
}, {
    dependsOn: [kms_secret_binding],
});
Copy
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
kms_secret_binding = gcp.kms.CryptoKeyIAMMember("kms-secret-binding",
    crypto_key_id="kms-key",
    role="roles/cloudkms.cryptoKeyEncrypterDecrypter",
    member=f"serviceAccount:service-{project.number}@gcp-sa-secretmanager.iam.gserviceaccount.com")
secret_with_automatic_cmek = gcp.secretmanager.Secret("secret-with-automatic-cmek",
    secret_id="secret",
    replication={
        "auto": {
            "customer_managed_encryption": {
                "kms_key_name": "kms-key",
            },
        },
    },
    opts = pulumi.ResourceOptions(depends_on=[kms_secret_binding]))
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/kms"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/secretmanager"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		kms_secret_binding, err := kms.NewCryptoKeyIAMMember(ctx, "kms-secret-binding", &kms.CryptoKeyIAMMemberArgs{
			CryptoKeyId: pulumi.String("kms-key"),
			Role:        pulumi.String("roles/cloudkms.cryptoKeyEncrypterDecrypter"),
			Member:      pulumi.Sprintf("serviceAccount:service-%v@gcp-sa-secretmanager.iam.gserviceaccount.com", project.Number),
		})
		if err != nil {
			return err
		}
		_, err = secretmanager.NewSecret(ctx, "secret-with-automatic-cmek", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret"),
			Replication: &secretmanager.SecretReplicationArgs{
				Auto: &secretmanager.SecretReplicationAutoArgs{
					CustomerManagedEncryption: &secretmanager.SecretReplicationAutoCustomerManagedEncryptionArgs{
						KmsKeyName: pulumi.String("kms-key"),
					},
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			kms_secret_binding,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var kms_secret_binding = new Gcp.Kms.CryptoKeyIAMMember("kms-secret-binding", new()
    {
        CryptoKeyId = "kms-key",
        Role = "roles/cloudkms.cryptoKeyEncrypterDecrypter",
        Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-secretmanager.iam.gserviceaccount.com",
    });

    var secret_with_automatic_cmek = new Gcp.SecretManager.Secret("secret-with-automatic-cmek", new()
    {
        SecretId = "secret",
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            Auto = new Gcp.SecretManager.Inputs.SecretReplicationAutoArgs
            {
                CustomerManagedEncryption = new Gcp.SecretManager.Inputs.SecretReplicationAutoCustomerManagedEncryptionArgs
                {
                    KmsKeyName = "kms-key",
                },
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            kms_secret_binding,
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.kms.CryptoKeyIAMMember;
import com.pulumi.gcp.kms.CryptoKeyIAMMemberArgs;
import com.pulumi.gcp.secretmanager.Secret;
import com.pulumi.gcp.secretmanager.SecretArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoArgs;
import com.pulumi.gcp.secretmanager.inputs.SecretReplicationAutoCustomerManagedEncryptionArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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) {
        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

        var kms_secret_binding = new CryptoKeyIAMMember("kms-secret-binding", CryptoKeyIAMMemberArgs.builder()
            .cryptoKeyId("kms-key")
            .role("roles/cloudkms.cryptoKeyEncrypterDecrypter")
            .member(String.format("serviceAccount:service-%s@gcp-sa-secretmanager.iam.gserviceaccount.com", project.number()))
            .build());

        var secret_with_automatic_cmek = new Secret("secret-with-automatic-cmek", SecretArgs.builder()
            .secretId("secret")
            .replication(SecretReplicationArgs.builder()
                .auto(SecretReplicationAutoArgs.builder()
                    .customerManagedEncryption(SecretReplicationAutoCustomerManagedEncryptionArgs.builder()
                        .kmsKeyName("kms-key")
                        .build())
                    .build())
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(kms_secret_binding)
                .build());

    }
}
Copy
resources:
  kms-secret-binding:
    type: gcp:kms:CryptoKeyIAMMember
    properties:
      cryptoKeyId: kms-key
      role: roles/cloudkms.cryptoKeyEncrypterDecrypter
      member: serviceAccount:service-${project.number}@gcp-sa-secretmanager.iam.gserviceaccount.com
  secret-with-automatic-cmek:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret
      replication:
        auto:
          customerManagedEncryption:
            kmsKeyName: kms-key
    options:
      dependsOn:
        - ${["kms-secret-binding"]}
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}
Copy

Create Secret Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Secret(name: string, args: SecretArgs, opts?: CustomResourceOptions);
@overload
def Secret(resource_name: str,
           args: SecretArgs,
           opts: Optional[ResourceOptions] = None)

@overload
def Secret(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           replication: Optional[SecretReplicationArgs] = None,
           secret_id: Optional[str] = None,
           annotations: Optional[Mapping[str, str]] = None,
           expire_time: Optional[str] = None,
           labels: Optional[Mapping[str, str]] = None,
           project: Optional[str] = None,
           rotation: Optional[SecretRotationArgs] = None,
           topics: Optional[Sequence[SecretTopicArgs]] = None,
           ttl: Optional[str] = None,
           version_aliases: Optional[Mapping[str, str]] = None,
           version_destroy_ttl: Optional[str] = None)
func NewSecret(ctx *Context, name string, args SecretArgs, opts ...ResourceOption) (*Secret, error)
public Secret(string name, SecretArgs args, CustomResourceOptions? opts = null)
public Secret(String name, SecretArgs args)
public Secret(String name, SecretArgs args, CustomResourceOptions options)
type: gcp:secretmanager:Secret
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SecretArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SecretArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SecretArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SecretArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SecretArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var secretResource = new Gcp.SecretManager.Secret("secretResource", new()
{
    Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
    {
        Auto = new Gcp.SecretManager.Inputs.SecretReplicationAutoArgs
        {
            CustomerManagedEncryption = new Gcp.SecretManager.Inputs.SecretReplicationAutoCustomerManagedEncryptionArgs
            {
                KmsKeyName = "string",
            },
        },
        UserManaged = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedArgs
        {
            Replicas = new[]
            {
                new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
                {
                    Location = "string",
                    CustomerManagedEncryption = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaCustomerManagedEncryptionArgs
                    {
                        KmsKeyName = "string",
                    },
                },
            },
        },
    },
    SecretId = "string",
    Annotations = 
    {
        { "string", "string" },
    },
    ExpireTime = "string",
    Labels = 
    {
        { "string", "string" },
    },
    Project = "string",
    Rotation = new Gcp.SecretManager.Inputs.SecretRotationArgs
    {
        NextRotationTime = "string",
        RotationPeriod = "string",
    },
    Topics = new[]
    {
        new Gcp.SecretManager.Inputs.SecretTopicArgs
        {
            Name = "string",
        },
    },
    Ttl = "string",
    VersionAliases = 
    {
        { "string", "string" },
    },
    VersionDestroyTtl = "string",
});
Copy
example, err := secretmanager.NewSecret(ctx, "secretResource", &secretmanager.SecretArgs{
	Replication: &secretmanager.SecretReplicationArgs{
		Auto: &secretmanager.SecretReplicationAutoArgs{
			CustomerManagedEncryption: &secretmanager.SecretReplicationAutoCustomerManagedEncryptionArgs{
				KmsKeyName: pulumi.String("string"),
			},
		},
		UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
			Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
				&secretmanager.SecretReplicationUserManagedReplicaArgs{
					Location: pulumi.String("string"),
					CustomerManagedEncryption: &secretmanager.SecretReplicationUserManagedReplicaCustomerManagedEncryptionArgs{
						KmsKeyName: pulumi.String("string"),
					},
				},
			},
		},
	},
	SecretId: pulumi.String("string"),
	Annotations: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	ExpireTime: pulumi.String("string"),
	Labels: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	Project: pulumi.String("string"),
	Rotation: &secretmanager.SecretRotationArgs{
		NextRotationTime: pulumi.String("string"),
		RotationPeriod:   pulumi.String("string"),
	},
	Topics: secretmanager.SecretTopicArray{
		&secretmanager.SecretTopicArgs{
			Name: pulumi.String("string"),
		},
	},
	Ttl: pulumi.String("string"),
	VersionAliases: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
	VersionDestroyTtl: pulumi.String("string"),
})
Copy
var secretResource = new Secret("secretResource", SecretArgs.builder()
    .replication(SecretReplicationArgs.builder()
        .auto(SecretReplicationAutoArgs.builder()
            .customerManagedEncryption(SecretReplicationAutoCustomerManagedEncryptionArgs.builder()
                .kmsKeyName("string")
                .build())
            .build())
        .userManaged(SecretReplicationUserManagedArgs.builder()
            .replicas(SecretReplicationUserManagedReplicaArgs.builder()
                .location("string")
                .customerManagedEncryption(SecretReplicationUserManagedReplicaCustomerManagedEncryptionArgs.builder()
                    .kmsKeyName("string")
                    .build())
                .build())
            .build())
        .build())
    .secretId("string")
    .annotations(Map.of("string", "string"))
    .expireTime("string")
    .labels(Map.of("string", "string"))
    .project("string")
    .rotation(SecretRotationArgs.builder()
        .nextRotationTime("string")
        .rotationPeriod("string")
        .build())
    .topics(SecretTopicArgs.builder()
        .name("string")
        .build())
    .ttl("string")
    .versionAliases(Map.of("string", "string"))
    .versionDestroyTtl("string")
    .build());
Copy
secret_resource = gcp.secretmanager.Secret("secretResource",
    replication={
        "auto": {
            "customer_managed_encryption": {
                "kms_key_name": "string",
            },
        },
        "user_managed": {
            "replicas": [{
                "location": "string",
                "customer_managed_encryption": {
                    "kms_key_name": "string",
                },
            }],
        },
    },
    secret_id="string",
    annotations={
        "string": "string",
    },
    expire_time="string",
    labels={
        "string": "string",
    },
    project="string",
    rotation={
        "next_rotation_time": "string",
        "rotation_period": "string",
    },
    topics=[{
        "name": "string",
    }],
    ttl="string",
    version_aliases={
        "string": "string",
    },
    version_destroy_ttl="string")
Copy
const secretResource = new gcp.secretmanager.Secret("secretResource", {
    replication: {
        auto: {
            customerManagedEncryption: {
                kmsKeyName: "string",
            },
        },
        userManaged: {
            replicas: [{
                location: "string",
                customerManagedEncryption: {
                    kmsKeyName: "string",
                },
            }],
        },
    },
    secretId: "string",
    annotations: {
        string: "string",
    },
    expireTime: "string",
    labels: {
        string: "string",
    },
    project: "string",
    rotation: {
        nextRotationTime: "string",
        rotationPeriod: "string",
    },
    topics: [{
        name: "string",
    }],
    ttl: "string",
    versionAliases: {
        string: "string",
    },
    versionDestroyTtl: "string",
});
Copy
type: gcp:secretmanager:Secret
properties:
    annotations:
        string: string
    expireTime: string
    labels:
        string: string
    project: string
    replication:
        auto:
            customerManagedEncryption:
                kmsKeyName: string
        userManaged:
            replicas:
                - customerManagedEncryption:
                    kmsKeyName: string
                  location: string
    rotation:
        nextRotationTime: string
        rotationPeriod: string
    secretId: string
    topics:
        - name: string
    ttl: string
    versionAliases:
        string: string
    versionDestroyTtl: string
Copy

Secret Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Secret resource accepts the following input properties:

Replication
This property is required.
Changes to this property will trigger replacement.
SecretReplication
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
SecretId
This property is required.
Changes to this property will trigger replacement.
string
This must be unique within the project.
Annotations Dictionary<string, string>
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
ExpireTime string
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
Labels Dictionary<string, string>
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
Project Changes to this property will trigger replacement. string
Rotation SecretRotation
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
Topics List<SecretTopic>
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
Ttl string
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
VersionAliases Dictionary<string, string>
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
VersionDestroyTtl string
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
Replication
This property is required.
Changes to this property will trigger replacement.
SecretReplicationArgs
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
SecretId
This property is required.
Changes to this property will trigger replacement.
string
This must be unique within the project.
Annotations map[string]string
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
ExpireTime string
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
Labels map[string]string
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
Project Changes to this property will trigger replacement. string
Rotation SecretRotationArgs
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
Topics []SecretTopicArgs
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
Ttl string
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
VersionAliases map[string]string
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
VersionDestroyTtl string
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
replication
This property is required.
Changes to this property will trigger replacement.
SecretReplication
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
secretId
This property is required.
Changes to this property will trigger replacement.
String
This must be unique within the project.
annotations Map<String,String>
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
expireTime String
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels Map<String,String>
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
project Changes to this property will trigger replacement. String
rotation SecretRotation
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
topics List<SecretTopic>
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl String
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
versionAliases Map<String,String>
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
versionDestroyTtl String
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
replication
This property is required.
Changes to this property will trigger replacement.
SecretReplication
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
secretId
This property is required.
Changes to this property will trigger replacement.
string
This must be unique within the project.
annotations {[key: string]: string}
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
expireTime string
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels {[key: string]: string}
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
project Changes to this property will trigger replacement. string
rotation SecretRotation
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
topics SecretTopic[]
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl string
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
versionAliases {[key: string]: string}
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
versionDestroyTtl string
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
replication
This property is required.
Changes to this property will trigger replacement.
SecretReplicationArgs
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
secret_id
This property is required.
Changes to this property will trigger replacement.
str
This must be unique within the project.
annotations Mapping[str, str]
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
expire_time str
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels Mapping[str, str]
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
project Changes to this property will trigger replacement. str
rotation SecretRotationArgs
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
topics Sequence[SecretTopicArgs]
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl str
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
version_aliases Mapping[str, str]
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
version_destroy_ttl str
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
replication
This property is required.
Changes to this property will trigger replacement.
Property Map
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
secretId
This property is required.
Changes to this property will trigger replacement.
String
This must be unique within the project.
annotations Map<String>
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
expireTime String
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels Map<String>
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
project Changes to this property will trigger replacement. String
rotation Property Map
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
topics List<Property Map>
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl String
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
versionAliases Map<String>
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
versionDestroyTtl String
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.

Outputs

All input properties are implicitly available as output properties. Additionally, the Secret resource produces the following output properties:

CreateTime string
The time at which the Secret was created.
EffectiveAnnotations Dictionary<string, string>
EffectiveLabels Dictionary<string, string>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
PulumiLabels Dictionary<string, string>
The combination of labels configured directly on the resource and default labels configured on the provider.
CreateTime string
The time at which the Secret was created.
EffectiveAnnotations map[string]string
EffectiveLabels map[string]string
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
PulumiLabels map[string]string
The combination of labels configured directly on the resource and default labels configured on the provider.
createTime String
The time at which the Secret was created.
effectiveAnnotations Map<String,String>
effectiveLabels Map<String,String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id String
The provider-assigned unique ID for this managed resource.
name String
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
pulumiLabels Map<String,String>
The combination of labels configured directly on the resource and default labels configured on the provider.
createTime string
The time at which the Secret was created.
effectiveAnnotations {[key: string]: string}
effectiveLabels {[key: string]: string}
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id string
The provider-assigned unique ID for this managed resource.
name string
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
pulumiLabels {[key: string]: string}
The combination of labels configured directly on the resource and default labels configured on the provider.
create_time str
The time at which the Secret was created.
effective_annotations Mapping[str, str]
effective_labels Mapping[str, str]
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id str
The provider-assigned unique ID for this managed resource.
name str
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
pulumi_labels Mapping[str, str]
The combination of labels configured directly on the resource and default labels configured on the provider.
createTime String
The time at which the Secret was created.
effectiveAnnotations Map<String>
effectiveLabels Map<String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
id String
The provider-assigned unique ID for this managed resource.
name String
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
pulumiLabels Map<String>
The combination of labels configured directly on the resource and default labels configured on the provider.

Look up Existing Secret Resource

Get an existing Secret resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SecretState, opts?: CustomResourceOptions): Secret
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        annotations: Optional[Mapping[str, str]] = None,
        create_time: Optional[str] = None,
        effective_annotations: Optional[Mapping[str, str]] = None,
        effective_labels: Optional[Mapping[str, str]] = None,
        expire_time: Optional[str] = None,
        labels: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        pulumi_labels: Optional[Mapping[str, str]] = None,
        replication: Optional[SecretReplicationArgs] = None,
        rotation: Optional[SecretRotationArgs] = None,
        secret_id: Optional[str] = None,
        topics: Optional[Sequence[SecretTopicArgs]] = None,
        ttl: Optional[str] = None,
        version_aliases: Optional[Mapping[str, str]] = None,
        version_destroy_ttl: Optional[str] = None) -> Secret
func GetSecret(ctx *Context, name string, id IDInput, state *SecretState, opts ...ResourceOption) (*Secret, error)
public static Secret Get(string name, Input<string> id, SecretState? state, CustomResourceOptions? opts = null)
public static Secret get(String name, Output<String> id, SecretState state, CustomResourceOptions options)
resources:  _:    type: gcp:secretmanager:Secret    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Annotations Dictionary<string, string>
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
CreateTime string
The time at which the Secret was created.
EffectiveAnnotations Dictionary<string, string>
EffectiveLabels Dictionary<string, string>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
ExpireTime string
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
Labels Dictionary<string, string>
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
Name string
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
Project Changes to this property will trigger replacement. string
PulumiLabels Dictionary<string, string>
The combination of labels configured directly on the resource and default labels configured on the provider.
Replication Changes to this property will trigger replacement. SecretReplication
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
Rotation SecretRotation
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
SecretId Changes to this property will trigger replacement. string
This must be unique within the project.
Topics List<SecretTopic>
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
Ttl string
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
VersionAliases Dictionary<string, string>
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
VersionDestroyTtl string
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
Annotations map[string]string
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
CreateTime string
The time at which the Secret was created.
EffectiveAnnotations map[string]string
EffectiveLabels map[string]string
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
ExpireTime string
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
Labels map[string]string
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
Name string
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
Project Changes to this property will trigger replacement. string
PulumiLabels map[string]string
The combination of labels configured directly on the resource and default labels configured on the provider.
Replication Changes to this property will trigger replacement. SecretReplicationArgs
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
Rotation SecretRotationArgs
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
SecretId Changes to this property will trigger replacement. string
This must be unique within the project.
Topics []SecretTopicArgs
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
Ttl string
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
VersionAliases map[string]string
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
VersionDestroyTtl string
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
annotations Map<String,String>
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
createTime String
The time at which the Secret was created.
effectiveAnnotations Map<String,String>
effectiveLabels Map<String,String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
expireTime String
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels Map<String,String>
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
name String
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
project Changes to this property will trigger replacement. String
pulumiLabels Map<String,String>
The combination of labels configured directly on the resource and default labels configured on the provider.
replication Changes to this property will trigger replacement. SecretReplication
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
rotation SecretRotation
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
secretId Changes to this property will trigger replacement. String
This must be unique within the project.
topics List<SecretTopic>
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl String
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
versionAliases Map<String,String>
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
versionDestroyTtl String
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
annotations {[key: string]: string}
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
createTime string
The time at which the Secret was created.
effectiveAnnotations {[key: string]: string}
effectiveLabels {[key: string]: string}
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
expireTime string
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels {[key: string]: string}
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
name string
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
project Changes to this property will trigger replacement. string
pulumiLabels {[key: string]: string}
The combination of labels configured directly on the resource and default labels configured on the provider.
replication Changes to this property will trigger replacement. SecretReplication
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
rotation SecretRotation
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
secretId Changes to this property will trigger replacement. string
This must be unique within the project.
topics SecretTopic[]
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl string
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
versionAliases {[key: string]: string}
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
versionDestroyTtl string
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
annotations Mapping[str, str]
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
create_time str
The time at which the Secret was created.
effective_annotations Mapping[str, str]
effective_labels Mapping[str, str]
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
expire_time str
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels Mapping[str, str]
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
name str
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
project Changes to this property will trigger replacement. str
pulumi_labels Mapping[str, str]
The combination of labels configured directly on the resource and default labels configured on the provider.
replication Changes to this property will trigger replacement. SecretReplicationArgs
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
rotation SecretRotationArgs
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
secret_id Changes to this property will trigger replacement. str
This must be unique within the project.
topics Sequence[SecretTopicArgs]
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl str
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
version_aliases Mapping[str, str]
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
version_destroy_ttl str
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.
annotations Map<String>
Custom metadata about the secret. Annotations are distinct from various forms of labels. Annotations exist to allow client tools to store their own state information without requiring a database. Annotation keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, begin and end with an alphanumeric character ([a-z0-9A-Z]), and may have dashes (-), underscores (_), dots (.), and alphanumerics in between these symbols. The total size of annotation keys and values must be less than 16KiB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the annotations present in your configuration. Please refer to the field 'effective_annotations' for all of the annotations present on the resource.
createTime String
The time at which the Secret was created.
effectiveAnnotations Map<String>
effectiveLabels Map<String>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
expireTime String
Timestamp in UTC when the Secret is scheduled to expire. This is always provided on output, regardless of what was sent on input. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". Only one of 'expire_time' or 'ttl' can be provided.
labels Map<String>
The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}-]{0,62} Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [\p{Ll}\p{Lo}\p{N}-]{0,63} No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field 'effective_labels' for all of the labels present on the resource.
name String
The resource name of the Secret. Format: projects/{{project}}/secrets/{{secret_id}}
project Changes to this property will trigger replacement. String
pulumiLabels Map<String>
The combination of labels configured directly on the resource and default labels configured on the provider.
replication Changes to this property will trigger replacement. Property Map
The replication policy of the secret data attached to the Secret. It cannot be changed after the Secret has been created. Structure is documented below.
rotation Property Map
The rotation time and period for a Secret. At 'next_rotation_time', Secret Manager will send a Pub/Sub notification to the topics configured on the Secret. 'topics' must be set to configure rotation.
secretId Changes to this property will trigger replacement. String
This must be unique within the project.
topics List<Property Map>
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
ttl String
The TTL for the Secret. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s". Only one of 'ttl' or 'expire_time' can be provided.
versionAliases Map<String>
Mapping from version alias to version name. A version alias is a string with a maximum length of 63 characters and can contain uppercase and lowercase letters, numerals, and the hyphen (-) and underscore ('_') characters. An alias string must start with a letter and cannot be the string 'latest' or 'NEW'. No more than 50 aliases can be assigned to a given secret. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.
versionDestroyTtl String
Secret Version TTL after destruction request. This is a part of the delayed delete feature on Secret Version. For secret with versionDestroyTtl>0, version destruction doesn't happen immediately on calling destroy instead the version goes to a disabled state and the actual destruction happens after this TTL expires.

Supporting Types

SecretReplication
, SecretReplicationArgs

Auto Changes to this property will trigger replacement. SecretReplicationAuto
The Secret will automatically be replicated without any restrictions. Structure is documented below.
UserManaged Changes to this property will trigger replacement. SecretReplicationUserManaged
The Secret will be replicated to the regions specified by the user. Structure is documented below.
Auto Changes to this property will trigger replacement. SecretReplicationAuto
The Secret will automatically be replicated without any restrictions. Structure is documented below.
UserManaged Changes to this property will trigger replacement. SecretReplicationUserManaged
The Secret will be replicated to the regions specified by the user. Structure is documented below.
auto Changes to this property will trigger replacement. SecretReplicationAuto
The Secret will automatically be replicated without any restrictions. Structure is documented below.
userManaged Changes to this property will trigger replacement. SecretReplicationUserManaged
The Secret will be replicated to the regions specified by the user. Structure is documented below.
auto Changes to this property will trigger replacement. SecretReplicationAuto
The Secret will automatically be replicated without any restrictions. Structure is documented below.
userManaged Changes to this property will trigger replacement. SecretReplicationUserManaged
The Secret will be replicated to the regions specified by the user. Structure is documented below.
auto Changes to this property will trigger replacement. SecretReplicationAuto
The Secret will automatically be replicated without any restrictions. Structure is documented below.
user_managed Changes to this property will trigger replacement. SecretReplicationUserManaged
The Secret will be replicated to the regions specified by the user. Structure is documented below.
auto Changes to this property will trigger replacement. Property Map
The Secret will automatically be replicated without any restrictions. Structure is documented below.
userManaged Changes to this property will trigger replacement. Property Map
The Secret will be replicated to the regions specified by the user. Structure is documented below.

SecretReplicationAuto
, SecretReplicationAutoArgs

CustomerManagedEncryption SecretReplicationAutoCustomerManagedEncryption
The customer-managed encryption configuration of the Secret. If no configuration is provided, Google-managed default encryption is used. Structure is documented below.
CustomerManagedEncryption SecretReplicationAutoCustomerManagedEncryption
The customer-managed encryption configuration of the Secret. If no configuration is provided, Google-managed default encryption is used. Structure is documented below.
customerManagedEncryption SecretReplicationAutoCustomerManagedEncryption
The customer-managed encryption configuration of the Secret. If no configuration is provided, Google-managed default encryption is used. Structure is documented below.
customerManagedEncryption SecretReplicationAutoCustomerManagedEncryption
The customer-managed encryption configuration of the Secret. If no configuration is provided, Google-managed default encryption is used. Structure is documented below.
customer_managed_encryption SecretReplicationAutoCustomerManagedEncryption
The customer-managed encryption configuration of the Secret. If no configuration is provided, Google-managed default encryption is used. Structure is documented below.
customerManagedEncryption Property Map
The customer-managed encryption configuration of the Secret. If no configuration is provided, Google-managed default encryption is used. Structure is documented below.

SecretReplicationAutoCustomerManagedEncryption
, SecretReplicationAutoCustomerManagedEncryptionArgs

KmsKeyName This property is required. string
Describes the Cloud KMS encryption key that will be used to protect destination secret.


KmsKeyName This property is required. string
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kmsKeyName This property is required. String
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kmsKeyName This property is required. string
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kms_key_name This property is required. str
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kmsKeyName This property is required. String
Describes the Cloud KMS encryption key that will be used to protect destination secret.


SecretReplicationUserManaged
, SecretReplicationUserManagedArgs

Replicas
This property is required.
Changes to this property will trigger replacement.
List<SecretReplicationUserManagedReplica>
The list of Replicas for this Secret. Cannot be empty. Structure is documented below.
Replicas
This property is required.
Changes to this property will trigger replacement.
[]SecretReplicationUserManagedReplica
The list of Replicas for this Secret. Cannot be empty. Structure is documented below.
replicas
This property is required.
Changes to this property will trigger replacement.
List<SecretReplicationUserManagedReplica>
The list of Replicas for this Secret. Cannot be empty. Structure is documented below.
replicas
This property is required.
Changes to this property will trigger replacement.
SecretReplicationUserManagedReplica[]
The list of Replicas for this Secret. Cannot be empty. Structure is documented below.
replicas
This property is required.
Changes to this property will trigger replacement.
Sequence[SecretReplicationUserManagedReplica]
The list of Replicas for this Secret. Cannot be empty. Structure is documented below.
replicas
This property is required.
Changes to this property will trigger replacement.
List<Property Map>
The list of Replicas for this Secret. Cannot be empty. Structure is documented below.

SecretReplicationUserManagedReplica
, SecretReplicationUserManagedReplicaArgs

Location
This property is required.
Changes to this property will trigger replacement.
string
The canonical IDs of the location to replicate data. For example: "us-east1".
CustomerManagedEncryption SecretReplicationUserManagedReplicaCustomerManagedEncryption
Customer Managed Encryption for the secret. Structure is documented below.
Location
This property is required.
Changes to this property will trigger replacement.
string
The canonical IDs of the location to replicate data. For example: "us-east1".
CustomerManagedEncryption SecretReplicationUserManagedReplicaCustomerManagedEncryption
Customer Managed Encryption for the secret. Structure is documented below.
location
This property is required.
Changes to this property will trigger replacement.
String
The canonical IDs of the location to replicate data. For example: "us-east1".
customerManagedEncryption SecretReplicationUserManagedReplicaCustomerManagedEncryption
Customer Managed Encryption for the secret. Structure is documented below.
location
This property is required.
Changes to this property will trigger replacement.
string
The canonical IDs of the location to replicate data. For example: "us-east1".
customerManagedEncryption SecretReplicationUserManagedReplicaCustomerManagedEncryption
Customer Managed Encryption for the secret. Structure is documented below.
location
This property is required.
Changes to this property will trigger replacement.
str
The canonical IDs of the location to replicate data. For example: "us-east1".
customer_managed_encryption SecretReplicationUserManagedReplicaCustomerManagedEncryption
Customer Managed Encryption for the secret. Structure is documented below.
location
This property is required.
Changes to this property will trigger replacement.
String
The canonical IDs of the location to replicate data. For example: "us-east1".
customerManagedEncryption Property Map
Customer Managed Encryption for the secret. Structure is documented below.

SecretReplicationUserManagedReplicaCustomerManagedEncryption
, SecretReplicationUserManagedReplicaCustomerManagedEncryptionArgs

KmsKeyName This property is required. string
Describes the Cloud KMS encryption key that will be used to protect destination secret.


KmsKeyName This property is required. string
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kmsKeyName This property is required. String
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kmsKeyName This property is required. string
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kms_key_name This property is required. str
Describes the Cloud KMS encryption key that will be used to protect destination secret.


kmsKeyName This property is required. String
Describes the Cloud KMS encryption key that will be used to protect destination secret.


SecretRotation
, SecretRotationArgs

NextRotationTime string
Timestamp in UTC at which the Secret is scheduled to rotate. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
RotationPeriod string
The Duration between rotation notifications. Must be in seconds and at least 3600s (1h) and at most 3153600000s (100 years). If rotationPeriod is set, next_rotation_time must be set. next_rotation_time will be advanced by this period when the service automatically sends rotation notifications.
NextRotationTime string
Timestamp in UTC at which the Secret is scheduled to rotate. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
RotationPeriod string
The Duration between rotation notifications. Must be in seconds and at least 3600s (1h) and at most 3153600000s (100 years). If rotationPeriod is set, next_rotation_time must be set. next_rotation_time will be advanced by this period when the service automatically sends rotation notifications.
nextRotationTime String
Timestamp in UTC at which the Secret is scheduled to rotate. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
rotationPeriod String
The Duration between rotation notifications. Must be in seconds and at least 3600s (1h) and at most 3153600000s (100 years). If rotationPeriod is set, next_rotation_time must be set. next_rotation_time will be advanced by this period when the service automatically sends rotation notifications.
nextRotationTime string
Timestamp in UTC at which the Secret is scheduled to rotate. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
rotationPeriod string
The Duration between rotation notifications. Must be in seconds and at least 3600s (1h) and at most 3153600000s (100 years). If rotationPeriod is set, next_rotation_time must be set. next_rotation_time will be advanced by this period when the service automatically sends rotation notifications.
next_rotation_time str
Timestamp in UTC at which the Secret is scheduled to rotate. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
rotation_period str
The Duration between rotation notifications. Must be in seconds and at least 3600s (1h) and at most 3153600000s (100 years). If rotationPeriod is set, next_rotation_time must be set. next_rotation_time will be advanced by this period when the service automatically sends rotation notifications.
nextRotationTime String
Timestamp in UTC at which the Secret is scheduled to rotate. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
rotationPeriod String
The Duration between rotation notifications. Must be in seconds and at least 3600s (1h) and at most 3153600000s (100 years). If rotationPeriod is set, next_rotation_time must be set. next_rotation_time will be advanced by this period when the service automatically sends rotation notifications.

SecretTopic
, SecretTopicArgs

Name This property is required. string
The resource name of the Pub/Sub topic that will be published to, in the following format: projects//topics/. For publication to succeed, the Secret Manager Service Agent service account must have pubsub.publisher permissions on the topic.
Name This property is required. string
The resource name of the Pub/Sub topic that will be published to, in the following format: projects//topics/. For publication to succeed, the Secret Manager Service Agent service account must have pubsub.publisher permissions on the topic.
name This property is required. String
The resource name of the Pub/Sub topic that will be published to, in the following format: projects//topics/. For publication to succeed, the Secret Manager Service Agent service account must have pubsub.publisher permissions on the topic.
name This property is required. string
The resource name of the Pub/Sub topic that will be published to, in the following format: projects//topics/. For publication to succeed, the Secret Manager Service Agent service account must have pubsub.publisher permissions on the topic.
name This property is required. str
The resource name of the Pub/Sub topic that will be published to, in the following format: projects//topics/. For publication to succeed, the Secret Manager Service Agent service account must have pubsub.publisher permissions on the topic.
name This property is required. String
The resource name of the Pub/Sub topic that will be published to, in the following format: projects//topics/. For publication to succeed, the Secret Manager Service Agent service account must have pubsub.publisher permissions on the topic.

Import

Secret can be imported using any of these accepted formats:

  • projects/{{project}}/secrets/{{secret_id}}

  • {{project}}/{{secret_id}}

  • {{secret_id}}

When using the pulumi import command, Secret can be imported using one of the formats above. For example:

$ pulumi import gcp:secretmanager/secret:Secret default projects/{{project}}/secrets/{{secret_id}}
Copy
$ pulumi import gcp:secretmanager/secret:Secret default {{project}}/{{secret_id}}
Copy
$ pulumi import gcp:secretmanager/secret:Secret default {{secret_id}}
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Google Cloud (GCP) Classic pulumi/pulumi-gcp
License
Apache-2.0
Notes
This Pulumi package is based on the google-beta Terraform Provider.