1. Packages
  2. Scaleway
  3. API Docs
  4. getSecretVersion
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

scaleway.getSecretVersion

Explore with Pulumi AI

scaleway logo
Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse

    Gets information about Scaleway a Secret Version. For more information, see the documentation.

    Examples

    Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as scaleway from "@pulumi/scaleway";
    import * as scaleway from "@pulumiverse/scaleway";
    
    const mainSecret = new scaleway.Secret("mainSecret", {description: "barr"});
    const mainSecretVersion = new scaleway.SecretVersion("mainSecretVersion", {
        description: "your description",
        secretId: mainSecret.id,
        data: "your_secret",
    });
    const dataBySecretId = scaleway.getSecretVersionOutput({
        secretId: mainSecret.id,
        revision: "1",
    });
    const dataBySecretName = scaleway.getSecretVersionOutput({
        secretName: mainSecret.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
    
    main_secret = scaleway.Secret("mainSecret", description="barr")
    main_secret_version = scaleway.SecretVersion("mainSecretVersion",
        description="your description",
        secret_id=main_secret.id,
        data="your_secret")
    data_by_secret_id = scaleway.get_secret_version_output(secret_id=main_secret.id,
        revision="1")
    data_by_secret_name = scaleway.get_secret_version_output(secret_name=main_secret.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 {
    		mainSecret, err := scaleway.NewSecret(ctx, "mainSecret", &scaleway.SecretArgs{
    			Description: pulumi.String("barr"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = scaleway.NewSecretVersion(ctx, "mainSecretVersion", &scaleway.SecretVersionArgs{
    			Description: pulumi.String("your description"),
    			SecretId:    mainSecret.ID(),
    			Data:        pulumi.String("your_secret"),
    		})
    		if err != nil {
    			return err
    		}
    		dataBySecretId := scaleway.LookupSecretVersionOutput(ctx, scaleway.GetSecretVersionOutputArgs{
    			SecretId: mainSecret.ID(),
    			Revision: pulumi.String("1"),
    		}, nil)
    		dataBySecretName := scaleway.LookupSecretVersionOutput(ctx, scaleway.GetSecretVersionOutputArgs{
    			SecretName: mainSecret.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(() => 
    {
        var mainSecret = new Scaleway.Secret("mainSecret", new()
        {
            Description = "barr",
        });
    
        var mainSecretVersion = new Scaleway.SecretVersion("mainSecretVersion", new()
        {
            Description = "your description",
            SecretId = mainSecret.Id,
            Data = "your_secret",
        });
    
        var dataBySecretId = Scaleway.GetSecretVersion.Invoke(new()
        {
            SecretId = mainSecret.Id,
            Revision = "1",
        });
    
        var dataBySecretName = Scaleway.GetSecretVersion.Invoke(new()
        {
            SecretName = mainSecret.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) {
            var mainSecret = new Secret("mainSecret", SecretArgs.builder()        
                .description("barr")
                .build());
    
            var mainSecretVersion = new SecretVersion("mainSecretVersion", SecretVersionArgs.builder()        
                .description("your description")
                .secretId(mainSecret.id())
                .data("your_secret")
                .build());
    
            final var dataBySecretId = ScalewayFunctions.getSecretVersion(GetSecretVersionArgs.builder()
                .secretId(mainSecret.id())
                .revision("1")
                .build());
    
            final var dataBySecretName = ScalewayFunctions.getSecretVersion(GetSecretVersionArgs.builder()
                .secretName(mainSecret.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:
      mainSecret:
        type: scaleway:Secret
        properties:
          description: barr
      mainSecretVersion:
        type: scaleway:SecretVersion
        properties:
          description: your description
          secretId: ${mainSecret.id}
          data: your_secret
    variables:
      dataBySecretId:
        fn::invoke:
          Function: scaleway:getSecretVersion
          Arguments:
            secretId: ${mainSecret.id}
            revision: '1'
      dataBySecretName:
        fn::invoke:
          Function: scaleway:getSecretVersion
          Arguments:
            secretName: ${mainSecret.name}
            revision: '1'
    outputs:
      #Output Sensitive data
      scalewaySecretAccessPayload: ${dataBySecretName.data}
      #Output Sensitive data
      scalewaySecretAccessPayloadById: ${dataBySecretId.data}
    

    Data

    Note: This Data Source give you access to the secret payload encoded en base64.

    Be aware 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 plan.

    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(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(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:

    ProjectId string
    The ID of the project the Secret version is associated with.
    Region string
    region) The region in which the resource exists.
    Revision string
    The revision for this Secret Version.
    SecretId string
    The Secret ID associated wit the secret version. Only one of secret_id and secret_name should be specified.
    SecretName string
    The Name of Secret associated wit the secret version. Only one of secret_id and secret_name should be specified.
    ProjectId string
    The ID of the project the Secret version is associated with.
    Region string
    region) The region in which the resource exists.
    Revision string
    The revision for this Secret Version.
    SecretId string
    The Secret ID associated wit the secret version. Only one of secret_id and secret_name should be specified.
    SecretName string
    The Name of Secret associated wit the secret version. Only one of secret_id and secret_name should be specified.
    projectId String
    The ID of the project the Secret version is associated with.
    region String
    region) The region in which the resource exists.
    revision String
    The revision for this Secret Version.
    secretId String
    The Secret ID associated wit the secret version. Only one of secret_id and secret_name should be specified.
    secretName String
    The Name of Secret associated wit the secret version. Only one of secret_id and secret_name should be specified.
    projectId string
    The ID of the project the Secret version is associated with.
    region string
    region) The region in which the resource exists.
    revision string
    The revision for this Secret Version.
    secretId string
    The Secret ID associated wit the secret version. Only one of secret_id and secret_name should be specified.
    secretName string
    The Name of Secret associated wit the secret version. Only one of secret_id and secret_name should be specified.
    project_id str
    The ID of the project the Secret version is associated with.
    region str
    region) The region in which the resource exists.
    revision str
    The revision for this Secret Version.
    secret_id str
    The Secret ID associated wit the secret version. Only one of secret_id and secret_name should be specified.
    secret_name str
    The Name of Secret associated wit the secret version. Only one of secret_id and secret_name should be specified.
    projectId String
    The ID of the project the Secret version is associated with.
    region String
    region) The region in which the resource exists.
    revision String
    The revision for this Secret Version.
    secretId String
    The Secret ID associated wit the secret version. Only one of secret_id and secret_name should be specified.
    secretName String
    The Name of Secret associated wit the secret version. Only one of secret_id and secret_name should be specified.

    getSecretVersion Result

    The following output properties are available:

    CreatedAt string
    Date and time of secret version's creation (RFC 3339 format).
    Data string
    The data payload of the secret version. more on the data section
    Description string
    (Optional) Description of the secret version (e.g. my-new-description).
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the Secret Version.
    UpdatedAt string
    Date and time of secret version's last update (RFC 3339 format).
    ProjectId string
    Region string
    Revision string
    SecretId string
    SecretName string
    CreatedAt string
    Date and time of secret version's creation (RFC 3339 format).
    Data string
    The data payload of the secret version. more on the data section
    Description string
    (Optional) Description of the secret version (e.g. my-new-description).
    Id string
    The provider-assigned unique ID for this managed resource.
    Status string
    The status of the Secret Version.
    UpdatedAt string
    Date and time of secret version's last update (RFC 3339 format).
    ProjectId string
    Region string
    Revision string
    SecretId string
    SecretName string
    createdAt String
    Date and time of secret version's creation (RFC 3339 format).
    data String
    The data payload of the secret version. more on the data section
    description String
    (Optional) Description of the secret version (e.g. my-new-description).
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the Secret Version.
    updatedAt String
    Date and time of secret version's last update (RFC 3339 format).
    projectId String
    region String
    revision String
    secretId String
    secretName String
    createdAt string
    Date and time of secret version's creation (RFC 3339 format).
    data string
    The data payload of the secret version. more on the data section
    description string
    (Optional) Description of the secret version (e.g. my-new-description).
    id string
    The provider-assigned unique ID for this managed resource.
    status string
    The status of the Secret Version.
    updatedAt string
    Date and time of secret version's last update (RFC 3339 format).
    projectId string
    region string
    revision string
    secretId string
    secretName string
    created_at str
    Date and time of secret version's creation (RFC 3339 format).
    data str
    The data payload of the secret version. more on the data section
    description str
    (Optional) Description of the secret version (e.g. my-new-description).
    id str
    The provider-assigned unique ID for this managed resource.
    status str
    The status of the Secret Version.
    updated_at str
    Date and time of secret version's last update (RFC 3339 format).
    project_id str
    region str
    revision str
    secret_id str
    secret_name str
    createdAt String
    Date and time of secret version's creation (RFC 3339 format).
    data String
    The data payload of the secret version. more on the data section
    description String
    (Optional) Description of the secret version (e.g. my-new-description).
    id String
    The provider-assigned unique ID for this managed resource.
    status String
    The status of the Secret Version.
    updatedAt String
    Date and time of secret version's last update (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.
    scaleway logo
    Scaleway v1.12.1 published on Monday, Apr 15, 2024 by pulumiverse