1. Packages
  2. Scaleway
  3. API Docs
  4. getSecretVersion
Scaleway v1.26.0 published on Friday, Mar 28, 2025 by pulumiverse

scaleway.getSecretVersion

Explore with Pulumi AI

Deprecated: scaleway.index/getsecretversion.getSecretVersion has been deprecated in favor of scaleway.secrets/getversion.getVersion

The scaleway.secrets.Version data source is used to get information about a specific secret version stored in Scaleway Secret Manager.

Refer to the Secret Manager product documentation and API documentation for more information.

Example Usage

Use Secret Manager

The following commands allow you to:

  • create a secret named fooii
  • create a new version of fooii containing data (your_secret)
  • retrieve the secret version specified by the secret ID and the desired version
  • retrieve the secret version specified by the secret name and the desired version

The output blocks display the sensitive data contained in your secret version.

import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumi/scaleway";
import * as scaleway from "@pulumiverse/scaleway";

// Create a secret named fooii
const main = new scaleway.secrets.Secret("main", {
    name: "fooii",
    description: "barr",
});
// Create a version of fooii containing data
const mainVersion = new scaleway.secrets.Version("main", {
    description: "your description",
    secretId: main.id,
    data: "your_secret",
});
// Retrieve the secret version specified by the secret ID and the desired version
const dataBySecretId = scaleway.secrets.getVersionOutput({
    secretId: main.id,
    revision: "1",
});
// Retrieve the secret version specified by the secret name and the desired version
const dataBySecretName = scaleway.secrets.getVersionOutput({
    secretName: main.name,
    revision: "1",
});
export const scalewaySecretAccessPayload = dataBySecretName.apply(dataBySecretName => dataBySecretName.data);
export const scalewaySecretAccessPayloadById = dataBySecretId.apply(dataBySecretId => dataBySecretId.data);
Copy
import pulumi
import pulumi_scaleway as scaleway
import pulumiverse_scaleway as scaleway

# Create a secret named fooii
main = scaleway.secrets.Secret("main",
    name="fooii",
    description="barr")
# Create a version of fooii containing data
main_version = scaleway.secrets.Version("main",
    description="your description",
    secret_id=main.id,
    data="your_secret")
# Retrieve the secret version specified by the secret ID and the desired version
data_by_secret_id = scaleway.secrets.get_version_output(secret_id=main.id,
    revision="1")
# Retrieve the secret version specified by the secret name and the desired version
data_by_secret_name = scaleway.secrets.get_version_output(secret_name=main.name,
    revision="1")
pulumi.export("scalewaySecretAccessPayload", data_by_secret_name.data)
pulumi.export("scalewaySecretAccessPayloadById", data_by_secret_id.data)
Copy
package main

import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/secrets"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// Create a secret named fooii
		main, err := secrets.NewSecret(ctx, "main", &secrets.SecretArgs{
			Name:        pulumi.String("fooii"),
			Description: pulumi.String("barr"),
		})
		if err != nil {
			return err
		}
		// Create a version of fooii containing data
		_, err = secrets.NewVersion(ctx, "main", &secrets.VersionArgs{
			Description: pulumi.String("your description"),
			SecretId:    main.ID(),
			Data:        pulumi.String("your_secret"),
		})
		if err != nil {
			return err
		}
		// Retrieve the secret version specified by the secret ID and the desired version
		dataBySecretId := secrets.LookupVersionOutput(ctx, secrets.GetVersionOutputArgs{
			SecretId: main.ID(),
			Revision: pulumi.String("1"),
		}, nil)
		// Retrieve the secret version specified by the secret name and the desired version
		dataBySecretName := secrets.LookupVersionOutput(ctx, secrets.GetVersionOutputArgs{
			SecretName: main.Name,
			Revision:   pulumi.String("1"),
		}, nil)
		ctx.Export("scalewaySecretAccessPayload", dataBySecretName.ApplyT(func(dataBySecretName secrets.GetVersionResult) (*string, error) {
			return &dataBySecretName.Data, nil
		}).(pulumi.StringPtrOutput))
		ctx.Export("scalewaySecretAccessPayloadById", dataBySecretId.ApplyT(func(dataBySecretId secrets.GetVersionResult) (*string, error) {
			return &dataBySecretId.Data, nil
		}).(pulumi.StringPtrOutput))
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumi.Scaleway;
using Scaleway = Pulumiverse.Scaleway;

return await Deployment.RunAsync(() => 
{
    // Create a secret named fooii
    var main = new Scaleway.Secrets.Secret("main", new()
    {
        Name = "fooii",
        Description = "barr",
    });

    // Create a version of fooii containing data
    var mainVersion = new Scaleway.Secrets.Version("main", new()
    {
        Description = "your description",
        SecretId = main.Id,
        Data = "your_secret",
    });

    // Retrieve the secret version specified by the secret ID and the desired version
    var dataBySecretId = Scaleway.Secrets.GetVersion.Invoke(new()
    {
        SecretId = main.Id,
        Revision = "1",
    });

    // Retrieve the secret version specified by the secret name and the desired version
    var dataBySecretName = Scaleway.Secrets.GetVersion.Invoke(new()
    {
        SecretName = main.Name,
        Revision = "1",
    });

    return new Dictionary<string, object?>
    {
        ["scalewaySecretAccessPayload"] = dataBySecretName.Apply(getVersionResult => getVersionResult.Data),
        ["scalewaySecretAccessPayloadById"] = dataBySecretId.Apply(getVersionResult => getVersionResult.Data),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.secrets.Secret;
import com.pulumi.scaleway.secrets.SecretArgs;
import com.pulumi.scaleway.secrets.Version;
import com.pulumi.scaleway.secrets.VersionArgs;
import com.pulumi.scaleway.secrets.SecretsFunctions;
import com.pulumi.scaleway.secrets.inputs.GetVersionArgs;
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) {
        // Create a secret named fooii
        var main = new Secret("main", SecretArgs.builder()
            .name("fooii")
            .description("barr")
            .build());

        // Create a version of fooii containing data
        var mainVersion = new Version("mainVersion", VersionArgs.builder()
            .description("your description")
            .secretId(main.id())
            .data("your_secret")
            .build());

        // Retrieve the secret version specified by the secret ID and the desired version
        final var dataBySecretId = SecretsFunctions.getVersion(GetVersionArgs.builder()
            .secretId(main.id())
            .revision("1")
            .build());

        // Retrieve the secret version specified by the secret name and the desired version
        final var dataBySecretName = SecretsFunctions.getVersion(GetVersionArgs.builder()
            .secretName(main.name())
            .revision("1")
            .build());

        ctx.export("scalewaySecretAccessPayload", dataBySecretName.applyValue(getVersionResult -> getVersionResult).applyValue(dataBySecretName -> dataBySecretName.applyValue(getVersionResult -> getVersionResult.data())));
        ctx.export("scalewaySecretAccessPayloadById", dataBySecretId.applyValue(getVersionResult -> getVersionResult).applyValue(dataBySecretId -> dataBySecretId.applyValue(getVersionResult -> getVersionResult.data())));
    }
}
Copy
resources:
  # Create a secret named fooii
  main:
    type: scaleway:secrets:Secret
    properties:
      name: fooii
      description: barr
  # Create a version of fooii containing data
  mainVersion:
    type: scaleway:secrets:Version
    name: main
    properties:
      description: your description
      secretId: ${main.id}
      data: your_secret
variables:
  # Retrieve the secret version specified by the secret ID and the desired version
  dataBySecretId:
    fn::invoke:
      function: scaleway:secrets:getVersion
      arguments:
        secretId: ${main.id}
        revision: '1'
  # Retrieve the secret version specified by the secret name and the desired version
  dataBySecretName:
    fn::invoke:
      function: scaleway:secrets:getVersion
      arguments:
        secretName: ${main.name}
        revision: '1'
outputs:
  # Display sensitive data
  scalewaySecretAccessPayload: ${dataBySecretName.data}
  # Display sensitive data
  scalewaySecretAccessPayloadById: ${dataBySecretId.data}
Copy

Data information

Note: This data source provides you with access to the secret payload, which is encoded in base64.

Keep in mind that this is a sensitive attribute. For more information, see Sensitive Data in State.

Important: This property is sensitive and will not be displayed in the pulumi preview, for security reasons.

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>
Copy
def get_secret_version(organization_id: Optional[str] = None,
                       project_id: Optional[str] = None,
                       region: Optional[str] = None,
                       revision: Optional[str] = None,
                       secret_id: Optional[str] = None,
                       secret_name: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetSecretVersionResult
def get_secret_version_output(organization_id: Optional[pulumi.Input[str]] = None,
                       project_id: Optional[pulumi.Input[str]] = None,
                       region: Optional[pulumi.Input[str]] = None,
                       revision: Optional[pulumi.Input[str]] = None,
                       secret_id: Optional[pulumi.Input[str]] = None,
                       secret_name: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetSecretVersionResult]
Copy
func LookupSecretVersion(ctx *Context, args *LookupSecretVersionArgs, opts ...InvokeOption) (*LookupSecretVersionResult, error)
func LookupSecretVersionOutput(ctx *Context, args *LookupSecretVersionOutputArgs, opts ...InvokeOption) LookupSecretVersionResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetSecretVersionResult> getSecretVersion(GetSecretVersionArgs args, InvokeOptions options)
public static Output<GetSecretVersionResult> getSecretVersion(GetSecretVersionArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: scaleway:index/getSecretVersion:getSecretVersion
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

OrganizationId string
ProjectId string
The ID of the Scaleway Project associated with the secret version.
Region string
Revision string
The revision for this secret version. Refer to alternative values (ex: latest) in the API documentation
SecretId string
The ID of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
SecretName string
The name of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
OrganizationId string
ProjectId string
The ID of the Scaleway Project associated with the secret version.
Region string
Revision string
The revision for this secret version. Refer to alternative values (ex: latest) in the API documentation
SecretId string
The ID of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
SecretName string
The name of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
organizationId String
projectId String
The ID of the Scaleway Project associated with the secret version.
region String
revision String
The revision for this secret version. Refer to alternative values (ex: latest) in the API documentation
secretId String
The ID of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
secretName String
The name of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
organizationId string
projectId string
The ID of the Scaleway Project associated with the secret version.
region string
revision string
The revision for this secret version. Refer to alternative values (ex: latest) in the API documentation
secretId string
The ID of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
secretName string
The name of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
organization_id str
project_id str
The ID of the Scaleway Project associated with the secret version.
region str
revision str
The revision for this secret version. Refer to alternative values (ex: latest) in the API documentation
secret_id str
The ID of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
secret_name str
The name of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
organizationId String
projectId String
The ID of the Scaleway Project associated with the secret version.
region String
revision String
The revision for this secret version. Refer to alternative values (ex: latest) in the API documentation
secretId String
The ID of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.
secretName String
The name of the secret associated with the secret version. Only one of secret_id and secret_name should be specified.

getSecretVersion Result

The following output properties are available:

CreatedAt string
The date and time of the secret version's creation in RFC 3339 format.
Data string
The data payload of the secret version. This is a sensitive attribute containing the secret value. Learn more in the data section.
Description string
(Optional) The description of the secret version (e.g. my-new-description).
Id string
The provider-assigned unique ID for this managed resource.
OrganizationId string
Status string
The status of the secret version.
UpdatedAt string
The date and time of the secret version's last update in RFC 3339 format.
ProjectId string
Region string
Revision string
SecretId string
SecretName string
CreatedAt string
The date and time of the secret version's creation in RFC 3339 format.
Data string
The data payload of the secret version. This is a sensitive attribute containing the secret value. Learn more in the data section.
Description string
(Optional) The description of the secret version (e.g. my-new-description).
Id string
The provider-assigned unique ID for this managed resource.
OrganizationId string
Status string
The status of the secret version.
UpdatedAt string
The date and time of the secret version's last update in RFC 3339 format.
ProjectId string
Region string
Revision string
SecretId string
SecretName string
createdAt String
The date and time of the secret version's creation in RFC 3339 format.
data String
The data payload of the secret version. This is a sensitive attribute containing the secret value. Learn more in the data section.
description String
(Optional) The description of the secret version (e.g. my-new-description).
id String
The provider-assigned unique ID for this managed resource.
organizationId String
status String
The status of the secret version.
updatedAt String
The date and time of the secret version's last update in RFC 3339 format.
projectId String
region String
revision String
secretId String
secretName String
createdAt string
The date and time of the secret version's creation in RFC 3339 format.
data string
The data payload of the secret version. This is a sensitive attribute containing the secret value. Learn more in the data section.
description string
(Optional) The description of the secret version (e.g. my-new-description).
id string
The provider-assigned unique ID for this managed resource.
organizationId string
status string
The status of the secret version.
updatedAt string
The date and time of the secret version's last update in RFC 3339 format.
projectId string
region string
revision string
secretId string
secretName string
created_at str
The date and time of the secret version's creation in RFC 3339 format.
data str
The data payload of the secret version. This is a sensitive attribute containing the secret value. Learn more in the data section.
description str
(Optional) The description of the secret version (e.g. my-new-description).
id str
The provider-assigned unique ID for this managed resource.
organization_id str
status str
The status of the secret version.
updated_at str
The date and time of the secret version's last update in RFC 3339 format.
project_id str
region str
revision str
secret_id str
secret_name str
createdAt String
The date and time of the secret version's creation in RFC 3339 format.
data String
The data payload of the secret version. This is a sensitive attribute containing the secret value. Learn more in the data section.
description String
(Optional) The description of the secret version (e.g. my-new-description).
id String
The provider-assigned unique ID for this managed resource.
organizationId String
status String
The status of the secret version.
updatedAt String
The date and time of the secret version's last update in RFC 3339 format.
projectId String
region String
revision String
secretId String
secretName String

Package Details

Repository
scaleway pulumiverse/pulumi-scaleway
License
Apache-2.0
Notes
This Pulumi package is based on the scaleway Terraform Provider.