1. Packages
  2. Scaleway
  3. API Docs
  4. getSecret
Scaleway v1.27.0 published on Monday, Apr 21, 2025 by pulumiverse

scaleway.getSecret

Explore with Pulumi AI

Deprecated: scaleway.index/getsecret.getSecret has been deprecated in favor of scaleway.secrets/getsecret.getSecret

The scaleway.secrets.Secret data source is used to get information about a specific secret in Scaleway’s Secret Manager.

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

Example Usage

Create a secret and get its information

The following commands allow you to:

  • create a secret named foo with the description barr
  • retrieve the secret’s information using the secret’s ID
  • retrieve the secret’s information using the secret’s name
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumi/scaleway";
import * as scaleway from "@pulumiverse/scaleway";

// Create a secret
const main = new scaleway.secrets.Secret("main", {
    name: "foo",
    description: "barr",
});
// Get the secret information specified by the secret ID
const mySecret = scaleway.secrets.getSecret({
    secretId: "11111111-1111-1111-1111-111111111111",
});
// Get the secret information specified by the secret name
const byName = scaleway.secrets.getSecret({
    name: "your_secret_name",
});
Copy
import pulumi
import pulumi_scaleway as scaleway
import pulumiverse_scaleway as scaleway

# Create a secret
main = scaleway.secrets.Secret("main",
    name="foo",
    description="barr")
# Get the secret information specified by the secret ID
my_secret = scaleway.secrets.get_secret(secret_id="11111111-1111-1111-1111-111111111111")
# Get the secret information specified by the secret name
by_name = scaleway.secrets.get_secret(name="your_secret_name")
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
		_, err := secrets.NewSecret(ctx, "main", &secrets.SecretArgs{
			Name:        pulumi.String("foo"),
			Description: pulumi.String("barr"),
		})
		if err != nil {
			return err
		}
		// Get the secret information specified by the secret ID
		_, err = secrets.LookupSecret(ctx, &secrets.LookupSecretArgs{
			SecretId: pulumi.StringRef("11111111-1111-1111-1111-111111111111"),
		}, nil)
		if err != nil {
			return err
		}
		// Get the secret information specified by the secret name
		_, err = secrets.LookupSecret(ctx, &secrets.LookupSecretArgs{
			Name: pulumi.StringRef("your_secret_name"),
		}, nil)
		if err != nil {
			return err
		}
		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
    var main = new Scaleway.Secrets.Secret("main", new()
    {
        Name = "foo",
        Description = "barr",
    });

    // Get the secret information specified by the secret ID
    var mySecret = Scaleway.Secrets.GetSecret.Invoke(new()
    {
        SecretId = "11111111-1111-1111-1111-111111111111",
    });

    // Get the secret information specified by the secret name
    var byName = Scaleway.Secrets.GetSecret.Invoke(new()
    {
        Name = "your_secret_name",
    });

});
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.SecretsFunctions;
import com.pulumi.scaleway.secrets.inputs.GetSecretArgs;
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
        var main = new Secret("main", SecretArgs.builder()
            .name("foo")
            .description("barr")
            .build());

        // Get the secret information specified by the secret ID
        final var mySecret = SecretsFunctions.getSecret(GetSecretArgs.builder()
            .secretId("11111111-1111-1111-1111-111111111111")
            .build());

        // Get the secret information specified by the secret name
        final var byName = SecretsFunctions.getSecret(GetSecretArgs.builder()
            .name("your_secret_name")
            .build());

    }
}
Copy
resources:
  # Create a secret
  main:
    type: scaleway:secrets:Secret
    properties:
      name: foo
      description: barr
variables:
  # Get the secret information specified by the secret ID
  mySecret:
    fn::invoke:
      function: scaleway:secrets:getSecret
      arguments:
        secretId: 11111111-1111-1111-1111-111111111111
  # Get the secret information specified by the secret name
  byName:
    fn::invoke:
      function: scaleway:secrets:getSecret
      arguments:
        name: your_secret_name
Copy

Using getSecret

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 getSecret(args: GetSecretArgs, opts?: InvokeOptions): Promise<GetSecretResult>
function getSecretOutput(args: GetSecretOutputArgs, opts?: InvokeOptions): Output<GetSecretResult>
Copy
def get_secret(name: Optional[str] = None,
               organization_id: Optional[str] = None,
               path: Optional[str] = None,
               project_id: Optional[str] = None,
               region: Optional[str] = None,
               secret_id: Optional[str] = None,
               opts: Optional[InvokeOptions] = None) -> GetSecretResult
def get_secret_output(name: Optional[pulumi.Input[str]] = None,
               organization_id: Optional[pulumi.Input[str]] = None,
               path: Optional[pulumi.Input[str]] = None,
               project_id: Optional[pulumi.Input[str]] = None,
               region: Optional[pulumi.Input[str]] = None,
               secret_id: Optional[pulumi.Input[str]] = None,
               opts: Optional[InvokeOptions] = None) -> Output[GetSecretResult]
Copy
func LookupSecret(ctx *Context, args *LookupSecretArgs, opts ...InvokeOption) (*LookupSecretResult, error)
func LookupSecretOutput(ctx *Context, args *LookupSecretOutputArgs, opts ...InvokeOption) LookupSecretResultOutput
Copy

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

public static class GetSecret 
{
    public static Task<GetSecretResult> InvokeAsync(GetSecretArgs args, InvokeOptions? opts = null)
    public static Output<GetSecretResult> Invoke(GetSecretInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
public static Output<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: scaleway:index/getSecret:getSecret
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name string
The name of the secret. Only one of name and secret_id should be specified.
OrganizationId string
The ID of the Scaleway Organization the Project is associated with. If no default organization_id is set, it must be set explicitly in this data source.
Path string
The path of the secret. Conflicts with secret_id.
ProjectId string
). The ID of the Project the secret is associated with.
Region string
). The region in which the secret exists.
SecretId string
The ID of the secret. Only one of name and secret_id should be specified.
Name string
The name of the secret. Only one of name and secret_id should be specified.
OrganizationId string
The ID of the Scaleway Organization the Project is associated with. If no default organization_id is set, it must be set explicitly in this data source.
Path string
The path of the secret. Conflicts with secret_id.
ProjectId string
). The ID of the Project the secret is associated with.
Region string
). The region in which the secret exists.
SecretId string
The ID of the secret. Only one of name and secret_id should be specified.
name String
The name of the secret. Only one of name and secret_id should be specified.
organizationId String
The ID of the Scaleway Organization the Project is associated with. If no default organization_id is set, it must be set explicitly in this data source.
path String
The path of the secret. Conflicts with secret_id.
projectId String
). The ID of the Project the secret is associated with.
region String
). The region in which the secret exists.
secretId String
The ID of the secret. Only one of name and secret_id should be specified.
name string
The name of the secret. Only one of name and secret_id should be specified.
organizationId string
The ID of the Scaleway Organization the Project is associated with. If no default organization_id is set, it must be set explicitly in this data source.
path string
The path of the secret. Conflicts with secret_id.
projectId string
). The ID of the Project the secret is associated with.
region string
). The region in which the secret exists.
secretId string
The ID of the secret. Only one of name and secret_id should be specified.
name str
The name of the secret. Only one of name and secret_id should be specified.
organization_id str
The ID of the Scaleway Organization the Project is associated with. If no default organization_id is set, it must be set explicitly in this data source.
path str
The path of the secret. Conflicts with secret_id.
project_id str
). The ID of the Project the secret is associated with.
region str
). The region in which the secret exists.
secret_id str
The ID of the secret. Only one of name and secret_id should be specified.
name String
The name of the secret. Only one of name and secret_id should be specified.
organizationId String
The ID of the Scaleway Organization the Project is associated with. If no default organization_id is set, it must be set explicitly in this data source.
path String
The path of the secret. Conflicts with secret_id.
projectId String
). The ID of the Project the secret is associated with.
region String
). The region in which the secret exists.
secretId String
The ID of the secret. Only one of name and secret_id should be specified.

getSecret Result

The following output properties are available:

CreatedAt string
Description string
EphemeralPolicies List<Pulumiverse.Scaleway.Outputs.GetSecretEphemeralPolicy>
Id string
The provider-assigned unique ID for this managed resource.
OrganizationId string
Protected bool
Status string
Tags List<string>
Type string
UpdatedAt string
VersionCount int
Versions List<Pulumiverse.Scaleway.Outputs.GetSecretVersion>
Name string
Path string
ProjectId string
Region string
SecretId string
CreatedAt string
Description string
EphemeralPolicies []GetSecretEphemeralPolicy
Id string
The provider-assigned unique ID for this managed resource.
OrganizationId string
Protected bool
Status string
Tags []string
Type string
UpdatedAt string
VersionCount int
Versions []GetSecretVersionType
Name string
Path string
ProjectId string
Region string
SecretId string
createdAt String
description String
ephemeralPolicies List<GetSecretEphemeralPolicy>
id String
The provider-assigned unique ID for this managed resource.
organizationId String
protected_ Boolean
status String
tags List<String>
type String
updatedAt String
versionCount Integer
versions List<GetSecretVersion>
name String
path String
projectId String
region String
secretId String
createdAt string
description string
ephemeralPolicies GetSecretEphemeralPolicy[]
id string
The provider-assigned unique ID for this managed resource.
organizationId string
protected boolean
status string
tags string[]
type string
updatedAt string
versionCount number
versions GetSecretVersion[]
name string
path string
projectId string
region string
secretId string
createdAt String
description String
ephemeralPolicies List<Property Map>
id String
The provider-assigned unique ID for this managed resource.
organizationId String
protected Boolean
status String
tags List<String>
type String
updatedAt String
versionCount Number
versions List<Property Map>
name String
path String
projectId String
region String
secretId String

Supporting Types

GetSecretEphemeralPolicy

Action This property is required. string
Action to perform when the version of a secret expires.
ExpiresOnceAccessed This property is required. bool
True if the secret version expires after a single user access.
Ttl This property is required. string
Time frame, from one second and up to one year, during which the secret's versions are valid. Has to be specified in Go Duration format
Action This property is required. string
Action to perform when the version of a secret expires.
ExpiresOnceAccessed This property is required. bool
True if the secret version expires after a single user access.
Ttl This property is required. string
Time frame, from one second and up to one year, during which the secret's versions are valid. Has to be specified in Go Duration format
action This property is required. String
Action to perform when the version of a secret expires.
expiresOnceAccessed This property is required. Boolean
True if the secret version expires after a single user access.
ttl This property is required. String
Time frame, from one second and up to one year, during which the secret's versions are valid. Has to be specified in Go Duration format
action This property is required. string
Action to perform when the version of a secret expires.
expiresOnceAccessed This property is required. boolean
True if the secret version expires after a single user access.
ttl This property is required. string
Time frame, from one second and up to one year, during which the secret's versions are valid. Has to be specified in Go Duration format
action This property is required. str
Action to perform when the version of a secret expires.
expires_once_accessed This property is required. bool
True if the secret version expires after a single user access.
ttl This property is required. str
Time frame, from one second and up to one year, during which the secret's versions are valid. Has to be specified in Go Duration format
action This property is required. String
Action to perform when the version of a secret expires.
expiresOnceAccessed This property is required. Boolean
True if the secret version expires after a single user access.
ttl This property is required. String
Time frame, from one second and up to one year, during which the secret's versions are valid. Has to be specified in Go Duration format

GetSecretVersion

CreatedAt This property is required. string
Date and time of secret version's creation (RFC 3339 format)
Description This property is required. string
Description of the secret version
Latest This property is required. bool
Returns true if the version is the latest.
Revision This property is required. string
The revision of secret version
SecretId This property is required. string
The ID of the secret. Only one of name and secret_id should be specified.
Status This property is required. string
Status of the secret version
UpdatedAt This property is required. string
Date and time of secret version's creation (RFC 3339 format)
CreatedAt This property is required. string
Date and time of secret version's creation (RFC 3339 format)
Description This property is required. string
Description of the secret version
Latest This property is required. bool
Returns true if the version is the latest.
Revision This property is required. string
The revision of secret version
SecretId This property is required. string
The ID of the secret. Only one of name and secret_id should be specified.
Status This property is required. string
Status of the secret version
UpdatedAt This property is required. string
Date and time of secret version's creation (RFC 3339 format)
createdAt This property is required. String
Date and time of secret version's creation (RFC 3339 format)
description This property is required. String
Description of the secret version
latest This property is required. Boolean
Returns true if the version is the latest.
revision This property is required. String
The revision of secret version
secretId This property is required. String
The ID of the secret. Only one of name and secret_id should be specified.
status This property is required. String
Status of the secret version
updatedAt This property is required. String
Date and time of secret version's creation (RFC 3339 format)
createdAt This property is required. string
Date and time of secret version's creation (RFC 3339 format)
description This property is required. string
Description of the secret version
latest This property is required. boolean
Returns true if the version is the latest.
revision This property is required. string
The revision of secret version
secretId This property is required. string
The ID of the secret. Only one of name and secret_id should be specified.
status This property is required. string
Status of the secret version
updatedAt This property is required. string
Date and time of secret version's creation (RFC 3339 format)
created_at This property is required. str
Date and time of secret version's creation (RFC 3339 format)
description This property is required. str
Description of the secret version
latest This property is required. bool
Returns true if the version is the latest.
revision This property is required. str
The revision of secret version
secret_id This property is required. str
The ID of the secret. Only one of name and secret_id should be specified.
status This property is required. str
Status of the secret version
updated_at This property is required. str
Date and time of secret version's creation (RFC 3339 format)
createdAt This property is required. String
Date and time of secret version's creation (RFC 3339 format)
description This property is required. String
Description of the secret version
latest This property is required. Boolean
Returns true if the version is the latest.
revision This property is required. String
The revision of secret version
secretId This property is required. String
The ID of the secret. Only one of name and secret_id should be specified.
status This property is required. String
Status of the secret version
updatedAt This property is required. String
Date and time of secret version's creation (RFC 3339 format)

Package Details

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