1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. secretmanager
  5. getSecretVersionAccess
Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi

gcp.secretmanager.getSecretVersionAccess

Explore with Pulumi AI

Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi

Get the value from a Secret Manager secret version. This is similar to the gcp.secretmanager.SecretVersion datasource, but it only requires the Secret Manager Secret Accessor role. For more information see the official documentation and API.

Example Usage

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

const basic = gcp.secretmanager.getSecretVersionAccess({
    secret: "my-secret",
});
Copy
import pulumi
import pulumi_gcp as gcp

basic = gcp.secretmanager.get_secret_version_access(secret="my-secret")
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.GetSecretVersionAccess(ctx, &secretmanager.GetSecretVersionAccessArgs{
			Secret: "my-secret",
		}, nil)
		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 basic = Gcp.SecretManager.GetSecretVersionAccess.Invoke(new()
    {
        Secret = "my-secret",
    });

});
Copy
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.GetSecretVersionAccessArgs;
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.getSecretVersionAccess(GetSecretVersionAccessArgs.builder()
            .secret("my-secret")
            .build());

    }
}
Copy
variables:
  basic:
    fn::invoke:
      function: gcp:secretmanager:getSecretVersionAccess
      arguments:
        secret: my-secret
Copy

Using getSecretVersionAccess

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 getSecretVersionAccess(args: GetSecretVersionAccessArgs, opts?: InvokeOptions): Promise<GetSecretVersionAccessResult>
function getSecretVersionAccessOutput(args: GetSecretVersionAccessOutputArgs, opts?: InvokeOptions): Output<GetSecretVersionAccessResult>
Copy
def get_secret_version_access(is_secret_data_base64: Optional[bool] = None,
                              project: Optional[str] = None,
                              secret: Optional[str] = None,
                              version: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetSecretVersionAccessResult
def get_secret_version_access_output(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[GetSecretVersionAccessResult]
Copy
func GetSecretVersionAccess(ctx *Context, args *GetSecretVersionAccessArgs, opts ...InvokeOption) (*GetSecretVersionAccessResult, error)
func GetSecretVersionAccessOutput(ctx *Context, args *GetSecretVersionAccessOutputArgs, opts ...InvokeOption) GetSecretVersionAccessResultOutput
Copy

> Note: This function is named GetSecretVersionAccess in the Go SDK.

public static class GetSecretVersionAccess 
{
    public static Task<GetSecretVersionAccessResult> InvokeAsync(GetSecretVersionAccessArgs args, InvokeOptions? opts = null)
    public static Output<GetSecretVersionAccessResult> Invoke(GetSecretVersionAccessInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecretVersionAccessResult> getSecretVersionAccess(GetSecretVersionAccessArgs args, InvokeOptions options)
public static Output<GetSecretVersionAccessResult> getSecretVersionAccess(GetSecretVersionAccessArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:secretmanager/getSecretVersionAccess:getSecretVersionAccess
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Secret This property is required. string
The secret to get the secret version for.
IsSecretDataBase64 bool
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 This property is required. string
The secret to get the secret version for.
IsSecretDataBase64 bool
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 This property is required. String
The secret to get the secret version for.
isSecretDataBase64 Boolean
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 This property is required. string
The secret to get the secret version for.
isSecretDataBase64 boolean
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 This property is required. str
The secret to get the secret version for.
is_secret_data_base64 bool
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 This property is required. String
The secret to get the secret version for.
isSecretDataBase64 Boolean
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.

getSecretVersionAccess Result

The following output properties are available:

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
SecretData string
The secret data. No larger than 64KiB.
Version string
IsSecretDataBase64 bool
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
SecretData string
The secret data. No larger than 64KiB.
Version string
IsSecretDataBase64 bool
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
secretData String
The secret data. No larger than 64KiB.
version String
isSecretDataBase64 Boolean
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
secretData string
The secret data. No larger than 64KiB.
version string
isSecretDataBase64 boolean
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
is_secret_data_base64 bool
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
secretData String
The secret data. No larger than 64KiB.
version String
isSecretDataBase64 Boolean

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.
Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi