scaleway.getSecretVersion
Explore with Pulumi AI
The scaleway.SecretVersion
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.Secret("main", {
name: "fooii",
description: "barr",
});
// Create a version of fooii containing data
const mainSecretVersion = new scaleway.SecretVersion("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.getSecretVersionOutput({
secretId: main.id,
revision: "1",
});
// Retrieve the secret version specified by the secret name and the desired version
const dataBySecretName = scaleway.getSecretVersionOutput({
secretName: main.name,
revision: "1",
});
export const scalewaySecretAccessPayload = dataBySecretName.apply(dataBySecretName => dataBySecretName.data);
export const scalewaySecretAccessPayloadById = dataBySecretId.apply(dataBySecretId => dataBySecretId.data);
import pulumi
import pulumi_scaleway as scaleway
import pulumiverse_scaleway as scaleway
# Create a secret named fooii
main = scaleway.Secret("main",
name="fooii",
description="barr")
# Create a version of fooii containing data
main_secret_version = scaleway.SecretVersion("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.get_secret_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.get_secret_version_output(secret_name=main.name,
revision="1")
pulumi.export("scalewaySecretAccessPayload", data_by_secret_name.data)
pulumi.export("scalewaySecretAccessPayloadById", data_by_secret_id.data)
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Create a secret named fooii
main, err := scaleway.NewSecret(ctx, "main", &scaleway.SecretArgs{
Name: pulumi.String("fooii"),
Description: pulumi.String("barr"),
})
if err != nil {
return err
}
// Create a version of fooii containing data
_, err = scaleway.NewSecretVersion(ctx, "main", &scaleway.SecretVersionArgs{
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 := scaleway.LookupSecretVersionOutput(ctx, scaleway.GetSecretVersionOutputArgs{
SecretId: main.ID(),
Revision: pulumi.String("1"),
}, nil)
// Retrieve the secret version specified by the secret name and the desired version
dataBySecretName := scaleway.LookupSecretVersionOutput(ctx, scaleway.GetSecretVersionOutputArgs{
SecretName: main.Name,
Revision: pulumi.String("1"),
}, nil)
ctx.Export("scalewaySecretAccessPayload", dataBySecretName.ApplyT(func(dataBySecretName scaleway.GetSecretVersionResult) (*string, error) {
return &dataBySecretName.Data, nil
}).(pulumi.StringPtrOutput))
ctx.Export("scalewaySecretAccessPayloadById", dataBySecretId.ApplyT(func(dataBySecretId scaleway.GetSecretVersionResult) (*string, error) {
return &dataBySecretId.Data, nil
}).(pulumi.StringPtrOutput))
return nil
})
}
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.Secret("main", new()
{
Name = "fooii",
Description = "barr",
});
// Create a version of fooii containing data
var mainSecretVersion = new Scaleway.SecretVersion("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.GetSecretVersion.Invoke(new()
{
SecretId = main.Id,
Revision = "1",
});
// Retrieve the secret version specified by the secret name and the desired version
var dataBySecretName = Scaleway.GetSecretVersion.Invoke(new()
{
SecretName = main.Name,
Revision = "1",
});
return new Dictionary<string, object?>
{
["scalewaySecretAccessPayload"] = dataBySecretName.Apply(getSecretVersionResult => getSecretVersionResult.Data),
["scalewaySecretAccessPayloadById"] = dataBySecretId.Apply(getSecretVersionResult => getSecretVersionResult.Data),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.Secret;
import com.pulumi.scaleway.SecretArgs;
import com.pulumi.scaleway.SecretVersion;
import com.pulumi.scaleway.SecretVersionArgs;
import com.pulumi.scaleway.ScalewayFunctions;
import com.pulumi.scaleway.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) {
// 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 mainSecretVersion = new SecretVersion("mainSecretVersion", SecretVersionArgs.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 = ScalewayFunctions.getSecretVersion(GetSecretVersionArgs.builder()
.secretId(main.id())
.revision("1")
.build());
// Retrieve the secret version specified by the secret name and the desired version
final var dataBySecretName = ScalewayFunctions.getSecretVersion(GetSecretVersionArgs.builder()
.secretName(main.name())
.revision("1")
.build());
ctx.export("scalewaySecretAccessPayload", dataBySecretName.applyValue(getSecretVersionResult -> getSecretVersionResult).applyValue(dataBySecretName -> dataBySecretName.applyValue(getSecretVersionResult -> getSecretVersionResult.data())));
ctx.export("scalewaySecretAccessPayloadById", dataBySecretId.applyValue(getSecretVersionResult -> getSecretVersionResult).applyValue(dataBySecretId -> dataBySecretId.applyValue(getSecretVersionResult -> getSecretVersionResult.data())));
}
}
resources:
# Create a secret named fooii
main:
type: scaleway:Secret
properties:
name: fooii
description: barr
# Create a version of fooii containing data
mainSecretVersion:
type: scaleway:SecretVersion
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:getSecretVersion
Arguments:
secretId: ${main.id}
revision: '1'
# Retrieve the secret version specified by the secret name and the desired version
dataBySecretName:
fn::invoke:
Function: scaleway:getSecretVersion
Arguments:
secretName: ${main.name}
revision: '1'
outputs:
# Display sensitive data
scalewaySecretAccessPayload: ${dataBySecretName.data}
# Display sensitive data
scalewaySecretAccessPayloadById: ${dataBySecretId.data}
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>
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]
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)
// Output-based functions aren't available in Java yet
fn::invoke:
function: scaleway:index/getSecretVersion:getSecretVersion
arguments:
# arguments dictionary
The following arguments are supported:
- Organization
Id string - Project
Id 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 - Secret
Id string - The ID of the secret associated with the secret version. Only one of
secret_id
andsecret_name
should be specified. - Secret
Name string - The name of the secret associated with the secret version.
Only one of
secret_id
andsecret_name
should be specified.
- Organization
Id string - Project
Id 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 - Secret
Id string - The ID of the secret associated with the secret version. Only one of
secret_id
andsecret_name
should be specified. - Secret
Name string - The name of the secret associated with the secret version.
Only one of
secret_id
andsecret_name
should be specified.
- organization
Id String - project
Id 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 - secret
Id String - The ID of the secret associated with the secret version. Only one of
secret_id
andsecret_name
should be specified. - secret
Name String - The name of the secret associated with the secret version.
Only one of
secret_id
andsecret_name
should be specified.
- organization
Id string - project
Id 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 - secret
Id string - The ID of the secret associated with the secret version. Only one of
secret_id
andsecret_name
should be specified. - secret
Name string - The name of the secret associated with the secret version.
Only one of
secret_id
andsecret_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
andsecret_name
should be specified. - secret_
name str - The name of the secret associated with the secret version.
Only one of
secret_id
andsecret_name
should be specified.
- organization
Id String - project
Id 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 - secret
Id String - The ID of the secret associated with the secret version. Only one of
secret_id
andsecret_name
should be specified. - secret
Name String - The name of the secret associated with the secret version.
Only one of
secret_id
andsecret_name
should be specified.
getSecretVersion Result
The following output properties are available:
- Created
At 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.
- Organization
Id string - Status string
- The status of the secret version.
- Updated
At string - The date and time of the secret version's last update in RFC 3339 format.
- Project
Id string - Region string
- Revision string
- Secret
Id string - Secret
Name string
- Created
At 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.
- Organization
Id string - Status string
- The status of the secret version.
- Updated
At string - The date and time of the secret version's last update in RFC 3339 format.
- Project
Id string - Region string
- Revision string
- Secret
Id string - Secret
Name string
- created
At 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.
- organization
Id String - status String
- The status of the secret version.
- updated
At String - The date and time of the secret version's last update in RFC 3339 format.
- project
Id String - region String
- revision String
- secret
Id String - secret
Name String
- created
At 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.
- organization
Id string - status string
- The status of the secret version.
- updated
At string - The date and time of the secret version's last update in RFC 3339 format.
- project
Id string - region string
- revision string
- secret
Id string - secret
Name 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
- created
At 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.
- organization
Id String - status String
- The status of the secret version.
- updated
At String - The date and time of the secret version's last update in RFC 3339 format.
- project
Id String - region String
- revision String
- secret
Id String - secret
Name String
Package Details
- Repository
- scaleway pulumiverse/pulumi-scaleway
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
scaleway
Terraform Provider.