Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
Get the value and metadata from a Secret Manager secret version. For more information see the official documentation and API. If you don’t need the metadata (i.e., if you want to use a more limited role to access the secret version only), see also the gcp.secretmanager.getSecretVersionAccess datasource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const basic = gcp.secretmanager.getSecretVersion({
secret: "my-secret",
});
import pulumi
import pulumi_gcp as gcp
basic = gcp.secretmanager.get_secret_version(secret="my-secret")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/secretmanager"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := secretmanager.LookupSecretVersion(ctx, &secretmanager.LookupSecretVersionArgs{
Secret: "my-secret",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var basic = Gcp.SecretManager.GetSecretVersion.Invoke(new()
{
Secret = "my-secret",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.secretmanager.SecretmanagerFunctions;
import com.pulumi.gcp.secretmanager.inputs.GetSecretVersionArgs;
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 basic = SecretmanagerFunctions.getSecretVersion(GetSecretVersionArgs.builder()
.secret("my-secret")
.build());
}
}
variables:
basic:
fn::invoke:
function: gcp:secretmanager:getSecretVersion
arguments:
secret: my-secret
Using getSecretVersion
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getSecretVersion(args: GetSecretVersionArgs, opts?: InvokeOptions): Promise<GetSecretVersionResult>
function getSecretVersionOutput(args: GetSecretVersionOutputArgs, opts?: InvokeOptions): Output<GetSecretVersionResult>def get_secret_version(fetch_secret_data: Optional[bool] = None,
is_secret_data_base64: Optional[bool] = None,
project: Optional[str] = None,
secret: Optional[str] = None,
version: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetSecretVersionResult
def get_secret_version_output(fetch_secret_data: Optional[pulumi.Input[bool]] = None,
is_secret_data_base64: Optional[pulumi.Input[bool]] = None,
project: Optional[pulumi.Input[str]] = None,
secret: Optional[pulumi.Input[str]] = None,
version: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetSecretVersionResult]func LookupSecretVersion(ctx *Context, args *LookupSecretVersionArgs, opts ...InvokeOption) (*LookupSecretVersionResult, error)
func LookupSecretVersionOutput(ctx *Context, args *LookupSecretVersionOutputArgs, opts ...InvokeOption) LookupSecretVersionResultOutput> Note: This function is named LookupSecretVersion in the Go SDK.
public static class GetSecretVersion
{
public static Task<GetSecretVersionResult> InvokeAsync(GetSecretVersionArgs args, InvokeOptions? opts = null)
public static Output<GetSecretVersionResult> Invoke(GetSecretVersionInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetSecretVersionResult> getSecretVersion(GetSecretVersionArgs args, InvokeOptions options)
public static Output<GetSecretVersionResult> getSecretVersion(GetSecretVersionArgs args, InvokeOptions options)
fn::invoke:
function: gcp:secretmanager/getSecretVersion:getSecretVersion
arguments:
# arguments dictionaryThe following arguments are supported:
- Secret string
- The secret to get the secret version for.
- Fetch
Secret boolData - If set to
false, thesecret_datawill not be fetched. Default istrue. - Is
Secret boolData Base64 - If set to
true, the secret data is expected to be base64-encoded string. - Project string
- The project to get the secret version for. If it is not provided, the provider project is used.
- Version string
- The version of the secret to get. If it is not provided, the latest version is retrieved.
- Secret string
- The secret to get the secret version for.
- Fetch
Secret boolData - If set to
false, thesecret_datawill not be fetched. Default istrue. - Is
Secret boolData Base64 - If set to
true, the secret data is expected to be base64-encoded string. - Project string
- The project to get the secret version for. If it is not provided, the provider project is used.
- Version string
- The version of the secret to get. If it is not provided, the latest version is retrieved.
- secret String
- The secret to get the secret version for.
- fetch
Secret BooleanData - If set to
false, thesecret_datawill not be fetched. Default istrue. - is
Secret BooleanData Base64 - If set to
true, the secret data is expected to be base64-encoded string. - project String
- The project to get the secret version for. If it is not provided, the provider project is used.
- version String
- The version of the secret to get. If it is not provided, the latest version is retrieved.
- secret string
- The secret to get the secret version for.
- fetch
Secret booleanData - If set to
false, thesecret_datawill not be fetched. Default istrue. - is
Secret booleanData Base64 - If set to
true, the secret data is expected to be base64-encoded string. - project string
- The project to get the secret version for. If it is not provided, the provider project is used.
- version string
- The version of the secret to get. If it is not provided, the latest version is retrieved.
- secret str
- The secret to get the secret version for.
- fetch_
secret_ booldata - If set to
false, thesecret_datawill not be fetched. Default istrue. - is_
secret_ booldata_ base64 - If set to
true, the secret data is expected to be base64-encoded string. - project str
- The project to get the secret version for. If it is not provided, the provider project is used.
- version str
- The version of the secret to get. If it is not provided, the latest version is retrieved.
- secret String
- The secret to get the secret version for.
- fetch
Secret BooleanData - If set to
false, thesecret_datawill not be fetched. Default istrue. - is
Secret BooleanData Base64 - If set to
true, the secret data is expected to be base64-encoded string. - project String
- The project to get the secret version for. If it is not provided, the provider project is used.
- version String
- The version of the secret to get. If it is not provided, the latest version is retrieved.
getSecretVersion Result
The following output properties are available:
- Create
Time string - The time at which the Secret was created.
- Destroy
Time string - The time at which the Secret was destroyed. Only present if state is DESTROYED.
- Enabled bool
- True if the current state of the SecretVersion is enabled.
- 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}} - Project string
- Secret string
- Secret
Data string - The secret data. No larger than 64KiB.
- Version string
- Fetch
Secret boolData - Is
Secret boolData Base64
- Create
Time string - The time at which the Secret was created.
- Destroy
Time string - The time at which the Secret was destroyed. Only present if state is DESTROYED.
- Enabled bool
- True if the current state of the SecretVersion is enabled.
- 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}} - Project string
- Secret string
- Secret
Data string - The secret data. No larger than 64KiB.
- Version string
- Fetch
Secret boolData - Is
Secret boolData Base64
- create
Time String - The time at which the Secret was created.
- destroy
Time String - The time at which the Secret was destroyed. Only present if state is DESTROYED.
- enabled Boolean
- True if the current state of the SecretVersion is enabled.
- 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}} - project String
- secret String
- secret
Data String - The secret data. No larger than 64KiB.
- version String
- fetch
Secret BooleanData - is
Secret BooleanData Base64
- create
Time string - The time at which the Secret was created.
- destroy
Time string - The time at which the Secret was destroyed. Only present if state is DESTROYED.
- enabled boolean
- True if the current state of the SecretVersion is enabled.
- 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}} - project string
- secret string
- secret
Data string - The secret data. No larger than 64KiB.
- version string
- fetch
Secret booleanData - is
Secret booleanData Base64
- 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.
- enabled bool
- True if the current state of the SecretVersion is enabled.
- 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}} - project str
- secret str
- secret_
data str - The secret data. No larger than 64KiB.
- version str
- fetch_
secret_ booldata - is_
secret_ booldata_ base64
- create
Time String - The time at which the Secret was created.
- destroy
Time String - The time at which the Secret was destroyed. Only present if state is DESTROYED.
- enabled Boolean
- True if the current state of the SecretVersion is enabled.
- 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}} - project String
- secret String
- secret
Data String - The secret data. No larger than 64KiB.
- version String
- fetch
Secret BooleanData - is
Secret BooleanData Base64
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-betaTerraform Provider.
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
published on Thursday, Mar 12, 2026 by Pulumi
