1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. secretmanager
  5. SecretVersion
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.secretmanager.SecretVersion

Explore with Pulumi AI

A secret version resource.

To get more information about SecretVersion, see:

Note: All arguments marked as write-only values will not be stored in the state: payload.secret_data_wo. Read more about Write-only Attributes.

Example Usage

Secret Version Basic

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

const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
    secretId: "secret-version",
    labels: {
        label: "my-label",
    },
    replication: {
        auto: {},
    },
});
const secret_version_basic = new gcp.secretmanager.SecretVersion("secret-version-basic", {
    secret: secret_basic.id,
    secretData: "secret-data",
});
Copy
import pulumi
import pulumi_gcp as gcp

secret_basic = gcp.secretmanager.Secret("secret-basic",
    secret_id="secret-version",
    labels={
        "label": "my-label",
    },
    replication={
        "auto": {},
    })
secret_version_basic = gcp.secretmanager.SecretVersion("secret-version-basic",
    secret=secret_basic.id,
    secret_data="secret-data")
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 {
		secret_basic, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret-version"),
			Labels: pulumi.StringMap{
				"label": pulumi.String("my-label"),
			},
			Replication: &secretmanager.SecretReplicationArgs{
				Auto: &secretmanager.SecretReplicationAutoArgs{},
			},
		})
		if err != nil {
			return err
		}
		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-basic", &secretmanager.SecretVersionArgs{
			Secret:     secret_basic.ID(),
			SecretData: pulumi.String("secret-data"),
		})
		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-version",
        Labels = 
        {
            { "label", "my-label" },
        },
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            Auto = null,
        },
    });

    var secret_version_basic = new Gcp.SecretManager.SecretVersion("secret-version-basic", new()
    {
        Secret = secret_basic.Id,
        SecretData = "secret-data",
    });

});
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 com.pulumi.gcp.secretmanager.SecretVersion;
import com.pulumi.gcp.secretmanager.SecretVersionArgs;
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-version")
            .labels(Map.of("label", "my-label"))
            .replication(SecretReplicationArgs.builder()
                .auto(SecretReplicationAutoArgs.builder()
                    .build())
                .build())
            .build());

        var secret_version_basic = new SecretVersion("secret-version-basic", SecretVersionArgs.builder()
            .secret(secret_basic.id())
            .secretData("secret-data")
            .build());

    }
}
Copy
resources:
  secret-basic:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret-version
      labels:
        label: my-label
      replication:
        auto: {}
  secret-version-basic:
    type: gcp:secretmanager:SecretVersion
    properties:
      secret: ${["secret-basic"].id}
      secretData: secret-data
Copy

Secret Version Basic Write Only

Coming soon!
Coming soon!
Coming soon!
Coming soon!
Coming soon!
resources:
  secret-basic-write-only:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret-version-write-only
      labels:
        label: my-label
      replication:
        auto: {}
  secret-version-basic-write-only:
    type: gcp:secretmanager:SecretVersion
    properties:
      secret: ${["secret-basic-write-only"].id}
      secretDataWoVersion: 1
      secretDataWo: secret-data-write-only
Copy

Secret Version Deletion Policy Abandon

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

const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
    secretId: "secret-version",
    replication: {
        userManaged: {
            replicas: [{
                location: "us-central1",
            }],
        },
    },
});
const secret_version_deletion_policy = new gcp.secretmanager.SecretVersion("secret-version-deletion-policy", {
    secret: secret_basic.id,
    secretData: "secret-data",
    deletionPolicy: "ABANDON",
});
Copy
import pulumi
import pulumi_gcp as gcp

secret_basic = gcp.secretmanager.Secret("secret-basic",
    secret_id="secret-version",
    replication={
        "user_managed": {
            "replicas": [{
                "location": "us-central1",
            }],
        },
    })
secret_version_deletion_policy = gcp.secretmanager.SecretVersion("secret-version-deletion-policy",
    secret=secret_basic.id,
    secret_data="secret-data",
    deletion_policy="ABANDON")
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 {
		secret_basic, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret-version"),
			Replication: &secretmanager.SecretReplicationArgs{
				UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
					Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
						&secretmanager.SecretReplicationUserManagedReplicaArgs{
							Location: pulumi.String("us-central1"),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-deletion-policy", &secretmanager.SecretVersionArgs{
			Secret:         secret_basic.ID(),
			SecretData:     pulumi.String("secret-data"),
			DeletionPolicy: pulumi.String("ABANDON"),
		})
		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-version",
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            UserManaged = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedArgs
            {
                Replicas = new[]
                {
                    new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
                    {
                        Location = "us-central1",
                    },
                },
            },
        },
    });

    var secret_version_deletion_policy = new Gcp.SecretManager.SecretVersion("secret-version-deletion-policy", new()
    {
        Secret = secret_basic.Id,
        SecretData = "secret-data",
        DeletionPolicy = "ABANDON",
    });

});
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 com.pulumi.gcp.secretmanager.SecretVersion;
import com.pulumi.gcp.secretmanager.SecretVersionArgs;
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-version")
            .replication(SecretReplicationArgs.builder()
                .userManaged(SecretReplicationUserManagedArgs.builder()
                    .replicas(SecretReplicationUserManagedReplicaArgs.builder()
                        .location("us-central1")
                        .build())
                    .build())
                .build())
            .build());

        var secret_version_deletion_policy = new SecretVersion("secret-version-deletion-policy", SecretVersionArgs.builder()
            .secret(secret_basic.id())
            .secretData("secret-data")
            .deletionPolicy("ABANDON")
            .build());

    }
}
Copy
resources:
  secret-basic:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret-version
      replication:
        userManaged:
          replicas:
            - location: us-central1
  secret-version-deletion-policy:
    type: gcp:secretmanager:SecretVersion
    properties:
      secret: ${["secret-basic"].id}
      secretData: secret-data
      deletionPolicy: ABANDON
Copy

Secret Version Deletion Policy Disable

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

const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
    secretId: "secret-version",
    replication: {
        userManaged: {
            replicas: [{
                location: "us-central1",
            }],
        },
    },
});
const secret_version_deletion_policy = new gcp.secretmanager.SecretVersion("secret-version-deletion-policy", {
    secret: secret_basic.id,
    secretData: "secret-data",
    deletionPolicy: "DISABLE",
});
Copy
import pulumi
import pulumi_gcp as gcp

secret_basic = gcp.secretmanager.Secret("secret-basic",
    secret_id="secret-version",
    replication={
        "user_managed": {
            "replicas": [{
                "location": "us-central1",
            }],
        },
    })
secret_version_deletion_policy = gcp.secretmanager.SecretVersion("secret-version-deletion-policy",
    secret=secret_basic.id,
    secret_data="secret-data",
    deletion_policy="DISABLE")
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 {
		secret_basic, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret-version"),
			Replication: &secretmanager.SecretReplicationArgs{
				UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
					Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
						&secretmanager.SecretReplicationUserManagedReplicaArgs{
							Location: pulumi.String("us-central1"),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-deletion-policy", &secretmanager.SecretVersionArgs{
			Secret:         secret_basic.ID(),
			SecretData:     pulumi.String("secret-data"),
			DeletionPolicy: pulumi.String("DISABLE"),
		})
		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-version",
        Replication = new Gcp.SecretManager.Inputs.SecretReplicationArgs
        {
            UserManaged = new Gcp.SecretManager.Inputs.SecretReplicationUserManagedArgs
            {
                Replicas = new[]
                {
                    new Gcp.SecretManager.Inputs.SecretReplicationUserManagedReplicaArgs
                    {
                        Location = "us-central1",
                    },
                },
            },
        },
    });

    var secret_version_deletion_policy = new Gcp.SecretManager.SecretVersion("secret-version-deletion-policy", new()
    {
        Secret = secret_basic.Id,
        SecretData = "secret-data",
        DeletionPolicy = "DISABLE",
    });

});
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 com.pulumi.gcp.secretmanager.SecretVersion;
import com.pulumi.gcp.secretmanager.SecretVersionArgs;
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-version")
            .replication(SecretReplicationArgs.builder()
                .userManaged(SecretReplicationUserManagedArgs.builder()
                    .replicas(SecretReplicationUserManagedReplicaArgs.builder()
                        .location("us-central1")
                        .build())
                    .build())
                .build())
            .build());

        var secret_version_deletion_policy = new SecretVersion("secret-version-deletion-policy", SecretVersionArgs.builder()
            .secret(secret_basic.id())
            .secretData("secret-data")
            .deletionPolicy("DISABLE")
            .build());

    }
}
Copy
resources:
  secret-basic:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret-version
      replication:
        userManaged:
          replicas:
            - location: us-central1
  secret-version-deletion-policy:
    type: gcp:secretmanager:SecretVersion
    properties:
      secret: ${["secret-basic"].id}
      secretData: secret-data
      deletionPolicy: DISABLE
Copy

Secret Version With Base64 String Secret Data

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

const secret_basic = new gcp.secretmanager.Secret("secret-basic", {
    secretId: "secret-version",
    replication: {
        userManaged: {
            replicas: [{
                location: "us-central1",
            }],
        },
    },
});
const secret_version_base64 = new gcp.secretmanager.SecretVersion("secret-version-base64", {
    secret: secret_basic.id,
    isSecretDataBase64: true,
    secretData: std.filebase64({
        input: "secret-data.pfx",
    }).then(invoke => invoke.result),
});
Copy
import pulumi
import pulumi_gcp as gcp
import pulumi_std as std

secret_basic = gcp.secretmanager.Secret("secret-basic",
    secret_id="secret-version",
    replication={
        "user_managed": {
            "replicas": [{
                "location": "us-central1",
            }],
        },
    })
secret_version_base64 = gcp.secretmanager.SecretVersion("secret-version-base64",
    secret=secret_basic.id,
    is_secret_data_base64=True,
    secret_data=std.filebase64(input="secret-data.pfx").result)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		secret_basic, err := secretmanager.NewSecret(ctx, "secret-basic", &secretmanager.SecretArgs{
			SecretId: pulumi.String("secret-version"),
			Replication: &secretmanager.SecretReplicationArgs{
				UserManaged: &secretmanager.SecretReplicationUserManagedArgs{
					Replicas: secretmanager.SecretReplicationUserManagedReplicaArray{
						&secretmanager.SecretReplicationUserManagedReplicaArgs{
							Location: pulumi.String("us-central1"),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		invokeFilebase64, err := std.Filebase64(ctx, &std.Filebase64Args{
			Input: "secret-data.pfx",
		}, nil)
		if err != nil {
			return err
		}
		_, err = secretmanager.NewSecretVersion(ctx, "secret-version-base64", &secretmanager.SecretVersionArgs{
			Secret:             secret_basic.ID(),
			IsSecretDataBase64: pulumi.Bool(true),
			SecretData:         pulumi.String(invokeFilebase64.Result),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Std = Pulumi.Std;

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

    var secret_version_base64 = new Gcp.SecretManager.SecretVersion("secret-version-base64", new()
    {
        Secret = secret_basic.Id,
        IsSecretDataBase64 = true,
        SecretData = Std.Filebase64.Invoke(new()
        {
            Input = "secret-data.pfx",
        }).Apply(invoke => invoke.Result),
    });

});
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 com.pulumi.gcp.secretmanager.SecretVersion;
import com.pulumi.gcp.secretmanager.SecretVersionArgs;
import com.pulumi.std.StdFunctions;
import com.pulumi.std.inputs.Filebase64Args;
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-version")
            .replication(SecretReplicationArgs.builder()
                .userManaged(SecretReplicationUserManagedArgs.builder()
                    .replicas(SecretReplicationUserManagedReplicaArgs.builder()
                        .location("us-central1")
                        .build())
                    .build())
                .build())
            .build());

        var secret_version_base64 = new SecretVersion("secret-version-base64", SecretVersionArgs.builder()
            .secret(secret_basic.id())
            .isSecretDataBase64(true)
            .secretData(StdFunctions.filebase64(Filebase64Args.builder()
                .input("secret-data.pfx")
                .build()).result())
            .build());

    }
}
Copy
resources:
  secret-basic:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret-version
      replication:
        userManaged:
          replicas:
            - location: us-central1
  secret-version-base64:
    type: gcp:secretmanager:SecretVersion
    properties:
      secret: ${["secret-basic"].id}
      isSecretDataBase64: true
      secretData:
        fn::invoke:
          function: std:filebase64
          arguments:
            input: secret-data.pfx
          return: result
Copy

Secret Version With Base64 String Secret Data Write Only

Coming soon!
Coming soon!
Coming soon!
Coming soon!
Coming soon!
resources:
  secret-basic:
    type: gcp:secretmanager:Secret
    properties:
      secretId: secret-version-base64-write-only
      replication:
        userManaged:
          replicas:
            - location: us-central1
  secret-version-base64-write-only:
    type: gcp:secretmanager:SecretVersion
    properties:
      secret: ${["secret-basic"].id}
      isSecretDataBase64: true
      secretDataWoVersion: 1
      secretDataWo:
        fn::invoke:
          function: std:filebase64
          arguments:
            input: secret-data-base64-write-only.pfx
          return: result
Copy

Ephemeral Attributes Reference

The following write-only attributes are supported:

  • secret_data_wo - (Optional) The secret data. Must be no larger than 64KiB. For more info see updating write-only attributes Note: This property is write-only and will not be read from the API.

The payload block supports:

  • secret_data_wo - (Optional) The secret data. Must be no larger than 64KiB. For more info see updating write-only attributes Note: This property is write-only and will not be read from the API.

Create SecretVersion Resource

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

Constructor syntax

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

@overload
def SecretVersion(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  secret: Optional[str] = None,
                  deletion_policy: Optional[str] = None,
                  enabled: Optional[bool] = None,
                  is_secret_data_base64: Optional[bool] = None,
                  secret_data: Optional[str] = None,
                  secret_data_wo_version: Optional[int] = None)
func NewSecretVersion(ctx *Context, name string, args SecretVersionArgs, opts ...ResourceOption) (*SecretVersion, error)
public SecretVersion(string name, SecretVersionArgs args, CustomResourceOptions? opts = null)
public SecretVersion(String name, SecretVersionArgs args)
public SecretVersion(String name, SecretVersionArgs args, CustomResourceOptions options)
type: gcp:secretmanager:SecretVersion
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. SecretVersionArgs
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. SecretVersionArgs
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. SecretVersionArgs
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. SecretVersionArgs
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. SecretVersionArgs
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 secretVersionResource = new Gcp.SecretManager.SecretVersion("secretVersionResource", new()
{
    Secret = "string",
    DeletionPolicy = "string",
    Enabled = false,
    IsSecretDataBase64 = false,
    SecretData = "string",
    SecretDataWoVersion = 0,
});
Copy
example, err := secretmanager.NewSecretVersion(ctx, "secretVersionResource", &secretmanager.SecretVersionArgs{
	Secret:              pulumi.String("string"),
	DeletionPolicy:      pulumi.String("string"),
	Enabled:             pulumi.Bool(false),
	IsSecretDataBase64:  pulumi.Bool(false),
	SecretData:          pulumi.String("string"),
	SecretDataWoVersion: pulumi.Int(0),
})
Copy
var secretVersionResource = new SecretVersion("secretVersionResource", SecretVersionArgs.builder()
    .secret("string")
    .deletionPolicy("string")
    .enabled(false)
    .isSecretDataBase64(false)
    .secretData("string")
    .secretDataWoVersion(0)
    .build());
Copy
secret_version_resource = gcp.secretmanager.SecretVersion("secretVersionResource",
    secret="string",
    deletion_policy="string",
    enabled=False,
    is_secret_data_base64=False,
    secret_data="string",
    secret_data_wo_version=0)
Copy
const secretVersionResource = new gcp.secretmanager.SecretVersion("secretVersionResource", {
    secret: "string",
    deletionPolicy: "string",
    enabled: false,
    isSecretDataBase64: false,
    secretData: "string",
    secretDataWoVersion: 0,
});
Copy
type: gcp:secretmanager:SecretVersion
properties:
    deletionPolicy: string
    enabled: false
    isSecretDataBase64: false
    secret: string
    secretData: string
    secretDataWoVersion: 0
Copy

SecretVersion 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 SecretVersion resource accepts the following input properties:

Secret
This property is required.
Changes to this property will trigger replacement.
string
Secret Manager secret resource


DeletionPolicy string
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
Enabled bool
The current state of the SecretVersion.
IsSecretDataBase64 Changes to this property will trigger replacement. bool
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
SecretData Changes to this property will trigger replacement. string
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
SecretDataWoVersion Changes to this property will trigger replacement. int
Triggers update of secret data write-only. For more info see updating write-only attributes
Secret
This property is required.
Changes to this property will trigger replacement.
string
Secret Manager secret resource


DeletionPolicy string
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
Enabled bool
The current state of the SecretVersion.
IsSecretDataBase64 Changes to this property will trigger replacement. bool
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
SecretData Changes to this property will trigger replacement. string
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
SecretDataWoVersion Changes to this property will trigger replacement. int
Triggers update of secret data write-only. For more info see updating write-only attributes
secret
This property is required.
Changes to this property will trigger replacement.
String
Secret Manager secret resource


deletionPolicy String
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
enabled Boolean
The current state of the SecretVersion.
isSecretDataBase64 Changes to this property will trigger replacement. Boolean
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
secretData Changes to this property will trigger replacement. String
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secretDataWoVersion Changes to this property will trigger replacement. Integer
Triggers update of secret data write-only. For more info see updating write-only attributes
secret
This property is required.
Changes to this property will trigger replacement.
string
Secret Manager secret resource


deletionPolicy string
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
enabled boolean
The current state of the SecretVersion.
isSecretDataBase64 Changes to this property will trigger replacement. boolean
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
secretData Changes to this property will trigger replacement. string
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secretDataWoVersion Changes to this property will trigger replacement. number
Triggers update of secret data write-only. For more info see updating write-only attributes
secret
This property is required.
Changes to this property will trigger replacement.
str
Secret Manager secret resource


deletion_policy str
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
enabled bool
The current state of the SecretVersion.
is_secret_data_base64 Changes to this property will trigger replacement. bool
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
secret_data Changes to this property will trigger replacement. str
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secret_data_wo_version Changes to this property will trigger replacement. int
Triggers update of secret data write-only. For more info see updating write-only attributes
secret
This property is required.
Changes to this property will trigger replacement.
String
Secret Manager secret resource


deletionPolicy String
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
enabled Boolean
The current state of the SecretVersion.
isSecretDataBase64 Changes to this property will trigger replacement. Boolean
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
secretData Changes to this property will trigger replacement. String
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secretDataWoVersion Changes to this property will trigger replacement. Number
Triggers update of secret data write-only. For more info see updating write-only attributes

Outputs

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

CreateTime string
The time at which the Secret was created.
DestroyTime string
The time at which the Secret was destroyed. Only present if state is DESTROYED.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
Version string
The version of the Secret.
CreateTime string
The time at which the Secret was created.
DestroyTime string
The time at which the Secret was destroyed. Only present if state is DESTROYED.
Id string
The provider-assigned unique ID for this managed resource.
Name string
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
Version string
The version of the Secret.
createTime String
The time at which the Secret was created.
destroyTime String
The time at which the Secret was destroyed. Only present if state is DESTROYED.
id String
The provider-assigned unique ID for this managed resource.
name String
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
version String
The version of the Secret.
createTime string
The time at which the Secret was created.
destroyTime string
The time at which the Secret was destroyed. Only present if state is DESTROYED.
id string
The provider-assigned unique ID for this managed resource.
name string
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
version string
The version of the Secret.
create_time str
The time at which the Secret was created.
destroy_time str
The time at which the Secret was destroyed. Only present if state is DESTROYED.
id str
The provider-assigned unique ID for this managed resource.
name str
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
version str
The version of the Secret.
createTime String
The time at which the Secret was created.
destroyTime String
The time at which the Secret was destroyed. Only present if state is DESTROYED.
id String
The provider-assigned unique ID for this managed resource.
name String
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
version String
The version of the Secret.

Look up Existing SecretVersion Resource

Get an existing SecretVersion 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?: SecretVersionState, opts?: CustomResourceOptions): SecretVersion
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        deletion_policy: Optional[str] = None,
        destroy_time: Optional[str] = None,
        enabled: Optional[bool] = None,
        is_secret_data_base64: Optional[bool] = None,
        name: Optional[str] = None,
        secret: Optional[str] = None,
        secret_data: Optional[str] = None,
        secret_data_wo_version: Optional[int] = None,
        version: Optional[str] = None) -> SecretVersion
func GetSecretVersion(ctx *Context, name string, id IDInput, state *SecretVersionState, opts ...ResourceOption) (*SecretVersion, error)
public static SecretVersion Get(string name, Input<string> id, SecretVersionState? state, CustomResourceOptions? opts = null)
public static SecretVersion get(String name, Output<String> id, SecretVersionState state, CustomResourceOptions options)
resources:  _:    type: gcp:secretmanager:SecretVersion    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:
CreateTime string
The time at which the Secret was created.
DeletionPolicy string
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
DestroyTime string
The time at which the Secret was destroyed. Only present if state is DESTROYED.
Enabled bool
The current state of the SecretVersion.
IsSecretDataBase64 Changes to this property will trigger replacement. bool
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
Name string
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
Secret Changes to this property will trigger replacement. string
Secret Manager secret resource


SecretData Changes to this property will trigger replacement. string
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
SecretDataWoVersion Changes to this property will trigger replacement. int
Triggers update of secret data write-only. For more info see updating write-only attributes
Version string
The version of the Secret.
CreateTime string
The time at which the Secret was created.
DeletionPolicy string
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
DestroyTime string
The time at which the Secret was destroyed. Only present if state is DESTROYED.
Enabled bool
The current state of the SecretVersion.
IsSecretDataBase64 Changes to this property will trigger replacement. bool
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
Name string
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
Secret Changes to this property will trigger replacement. string
Secret Manager secret resource


SecretData Changes to this property will trigger replacement. string
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
SecretDataWoVersion Changes to this property will trigger replacement. int
Triggers update of secret data write-only. For more info see updating write-only attributes
Version string
The version of the Secret.
createTime String
The time at which the Secret was created.
deletionPolicy String
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
destroyTime String
The time at which the Secret was destroyed. Only present if state is DESTROYED.
enabled Boolean
The current state of the SecretVersion.
isSecretDataBase64 Changes to this property will trigger replacement. Boolean
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
name String
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
secret Changes to this property will trigger replacement. String
Secret Manager secret resource


secretData Changes to this property will trigger replacement. String
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secretDataWoVersion Changes to this property will trigger replacement. Integer
Triggers update of secret data write-only. For more info see updating write-only attributes
version String
The version of the Secret.
createTime string
The time at which the Secret was created.
deletionPolicy string
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
destroyTime string
The time at which the Secret was destroyed. Only present if state is DESTROYED.
enabled boolean
The current state of the SecretVersion.
isSecretDataBase64 Changes to this property will trigger replacement. boolean
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
name string
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
secret Changes to this property will trigger replacement. string
Secret Manager secret resource


secretData Changes to this property will trigger replacement. string
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secretDataWoVersion Changes to this property will trigger replacement. number
Triggers update of secret data write-only. For more info see updating write-only attributes
version string
The version of the Secret.
create_time str
The time at which the Secret was created.
deletion_policy str
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
destroy_time str
The time at which the Secret was destroyed. Only present if state is DESTROYED.
enabled bool
The current state of the SecretVersion.
is_secret_data_base64 Changes to this property will trigger replacement. bool
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
name str
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
secret Changes to this property will trigger replacement. str
Secret Manager secret resource


secret_data Changes to this property will trigger replacement. str
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secret_data_wo_version Changes to this property will trigger replacement. int
Triggers update of secret data write-only. For more info see updating write-only attributes
version str
The version of the Secret.
createTime String
The time at which the Secret was created.
deletionPolicy String
The deletion policy for the secret version. Setting ABANDON allows the resource to be abandoned rather than deleted. Setting DISABLE allows the resource to be disabled rather than deleted. Default is DELETE. Possible values are:

  • DELETE
  • DISABLE
  • ABANDON
destroyTime String
The time at which the Secret was destroyed. Only present if state is DESTROYED.
enabled Boolean
The current state of the SecretVersion.
isSecretDataBase64 Changes to this property will trigger replacement. Boolean
If set to 'true', the secret data is expected to be base64-encoded string and would be sent as is.
name String
The resource name of the SecretVersion. Format: projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
secret Changes to this property will trigger replacement. String
Secret Manager secret resource


secretData Changes to this property will trigger replacement. String
The secret data. Must be no larger than 64KiB. Note: This property is sensitive and will not be displayed in the plan.
secretDataWoVersion Changes to this property will trigger replacement. Number
Triggers update of secret data write-only. For more info see updating write-only attributes
version String
The version of the Secret.

Import

SecretVersion can be imported using any of these accepted formats:

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

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

$ pulumi import gcp:secretmanager/secretVersion:SecretVersion default projects/{{project}}/secrets/{{secret_id}}/versions/{{version}}
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.