1. Packages
  2. Snowflake Provider
  3. API Docs
  4. getSecrets
Snowflake v0.61.1 published on Thursday, Nov 14, 2024 by Pulumi

snowflake.getSecrets

Explore with Pulumi AI

snowflake logo
Snowflake v0.61.1 published on Thursday, Nov 14, 2024 by Pulumi

    !> V1 release candidate This data source is a release candidate for the V1. We do not expect significant changes in it before the V1. We will welcome any feedback and adjust the data source if needed. Any errors reported will be resolved with a higher priority. We encourage checking this data source out before the V1 release. Please follow the migration guide to use it.

    Datasource used to get details of filtered secrets. Filtering is aligned with the current possibilities for SHOW SECRETS query. The results of SHOW and DESCRIBE are encapsulated in one output collection secrets.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as snowflake from "@pulumi/snowflake";
    
    // Simple usage
    const simple = snowflake.getSecrets({});
    export const simpleOutput = simple.then(simple => simple.secrets);
    // Filtering (like)
    const like = snowflake.getSecrets({
        like: "secret-name",
    });
    export const likeOutput = like.then(like => like.secrets);
    // Filtering by prefix (like)
    const likePrefix = snowflake.getSecrets({
        like: "prefix%",
    });
    export const likePrefixOutput = likePrefix.then(likePrefix => likePrefix.secrets);
    // Filtering (in)
    const in = snowflake.getSecrets({
        "in": {
            schema: test.fullyQualifiedName,
        },
    });
    export const inOutput = _in.then(_in => _in.secrets);
    // Without additional data (to limit the number of calls make for every found secret)
    const onlyShow = snowflake.getSecrets({
        withDescribe: false,
    });
    export const onlyShowOutput = onlyShow.then(onlyShow => onlyShow.secrets);
    
    import pulumi
    import pulumi_snowflake as snowflake
    
    # Simple usage
    simple = snowflake.get_secrets()
    pulumi.export("simpleOutput", simple.secrets)
    # Filtering (like)
    like = snowflake.get_secrets(like="secret-name")
    pulumi.export("likeOutput", like.secrets)
    # Filtering by prefix (like)
    like_prefix = snowflake.get_secrets(like="prefix%")
    pulumi.export("likePrefixOutput", like_prefix.secrets)
    # Filtering (in)
    in_ = snowflake.get_secrets(in_={
        "schema": test["fullyQualifiedName"],
    })
    pulumi.export("inOutput", in_.secrets)
    # Without additional data (to limit the number of calls make for every found secret)
    only_show = snowflake.get_secrets(with_describe=False)
    pulumi.export("onlyShowOutput", only_show.secrets)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-snowflake/sdk/go/snowflake"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Simple usage
    		simple, err := snowflake.GetSecrets(ctx, &snowflake.GetSecretsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("simpleOutput", simple.Secrets)
    		// Filtering (like)
    		like, err := snowflake.GetSecrets(ctx, &snowflake.GetSecretsArgs{
    			Like: pulumi.StringRef("secret-name"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("likeOutput", like.Secrets)
    		// Filtering by prefix (like)
    		likePrefix, err := snowflake.GetSecrets(ctx, &snowflake.GetSecretsArgs{
    			Like: pulumi.StringRef("prefix%"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("likePrefixOutput", likePrefix.Secrets)
    		// Filtering (in)
    		in, err := snowflake.GetSecrets(ctx, &snowflake.GetSecretsArgs{
    			In: snowflake.GetSecretsIn{
    				Schema: pulumi.StringRef(test.FullyQualifiedName),
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("inOutput", in.Secrets)
    		// Without additional data (to limit the number of calls make for every found secret)
    		onlyShow, err := snowflake.GetSecrets(ctx, &snowflake.GetSecretsArgs{
    			WithDescribe: pulumi.BoolRef(false),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("onlyShowOutput", onlyShow.Secrets)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Snowflake = Pulumi.Snowflake;
    
    return await Deployment.RunAsync(() => 
    {
        // Simple usage
        var simple = Snowflake.GetSecrets.Invoke();
    
        // Filtering (like)
        var like = Snowflake.GetSecrets.Invoke(new()
        {
            Like = "secret-name",
        });
    
        // Filtering by prefix (like)
        var likePrefix = Snowflake.GetSecrets.Invoke(new()
        {
            Like = "prefix%",
        });
    
        // Filtering (in)
        var @in = Snowflake.GetSecrets.Invoke(new()
        {
            In = new Snowflake.Inputs.GetSecretsInInputArgs
            {
                Schema = test.FullyQualifiedName,
            },
        });
    
        // Without additional data (to limit the number of calls make for every found secret)
        var onlyShow = Snowflake.GetSecrets.Invoke(new()
        {
            WithDescribe = false,
        });
    
        return new Dictionary<string, object?>
        {
            ["simpleOutput"] = simple.Apply(getSecretsResult => getSecretsResult.Secrets),
            ["likeOutput"] = like.Apply(getSecretsResult => getSecretsResult.Secrets),
            ["likePrefixOutput"] = likePrefix.Apply(getSecretsResult => getSecretsResult.Secrets),
            ["inOutput"] = @in.Apply(@in => @in.Apply(getSecretsResult => getSecretsResult.Secrets)),
            ["onlyShowOutput"] = onlyShow.Apply(getSecretsResult => getSecretsResult.Secrets),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.snowflake.SnowflakeFunctions;
    import com.pulumi.snowflake.inputs.GetSecretsArgs;
    import com.pulumi.snowflake.inputs.GetSecretsInArgs;
    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) {
            // Simple usage
            final var simple = SnowflakeFunctions.getSecrets();
    
            ctx.export("simpleOutput", simple.applyValue(getSecretsResult -> getSecretsResult.secrets()));
            // Filtering (like)
            final var like = SnowflakeFunctions.getSecrets(GetSecretsArgs.builder()
                .like("secret-name")
                .build());
    
            ctx.export("likeOutput", like.applyValue(getSecretsResult -> getSecretsResult.secrets()));
            // Filtering by prefix (like)
            final var likePrefix = SnowflakeFunctions.getSecrets(GetSecretsArgs.builder()
                .like("prefix%")
                .build());
    
            ctx.export("likePrefixOutput", likePrefix.applyValue(getSecretsResult -> getSecretsResult.secrets()));
            // Filtering (in)
            final var in = SnowflakeFunctions.getSecrets(GetSecretsArgs.builder()
                .in(GetSecretsInArgs.builder()
                    .schema(test.fullyQualifiedName())
                    .build())
                .build());
    
            ctx.export("inOutput", in.applyValue(getSecretsResult -> getSecretsResult.secrets()));
            // Without additional data (to limit the number of calls make for every found secret)
            final var onlyShow = SnowflakeFunctions.getSecrets(GetSecretsArgs.builder()
                .withDescribe(false)
                .build());
    
            ctx.export("onlyShowOutput", onlyShow.applyValue(getSecretsResult -> getSecretsResult.secrets()));
        }
    }
    
    variables:
      # Simple usage
      simple:
        fn::invoke:
          Function: snowflake:getSecrets
          Arguments: {}
      # Filtering (like)
      like:
        fn::invoke:
          Function: snowflake:getSecrets
          Arguments:
            like: secret-name
      # Filtering by prefix (like)
      likePrefix:
        fn::invoke:
          Function: snowflake:getSecrets
          Arguments:
            like: prefix%
      # Filtering (in)
      in:
        fn::invoke:
          Function: snowflake:getSecrets
          Arguments:
            in:
              schema: ${test.fullyQualifiedName}
      # Without additional data (to limit the number of calls make for every found secret)
      onlyShow:
        fn::invoke:
          Function: snowflake:getSecrets
          Arguments:
            withDescribe: false
    outputs:
      simpleOutput: ${simple.secrets}
      likeOutput: ${like.secrets}
      likePrefixOutput: ${likePrefix.secrets}
      inOutput: ${in.secrets}
      onlyShowOutput: ${onlyShow.secrets}
    

    Using getSecrets

    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 getSecrets(args: GetSecretsArgs, opts?: InvokeOptions): Promise<GetSecretsResult>
    function getSecretsOutput(args: GetSecretsOutputArgs, opts?: InvokeOptions): Output<GetSecretsResult>
    def get_secrets(in_: Optional[GetSecretsIn] = None,
                    like: Optional[str] = None,
                    with_describe: Optional[bool] = None,
                    opts: Optional[InvokeOptions] = None) -> GetSecretsResult
    def get_secrets_output(in_: Optional[pulumi.Input[GetSecretsInArgs]] = None,
                    like: Optional[pulumi.Input[str]] = None,
                    with_describe: Optional[pulumi.Input[bool]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetSecretsResult]
    func GetSecrets(ctx *Context, args *GetSecretsArgs, opts ...InvokeOption) (*GetSecretsResult, error)
    func GetSecretsOutput(ctx *Context, args *GetSecretsOutputArgs, opts ...InvokeOption) GetSecretsResultOutput

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

    public static class GetSecrets 
    {
        public static Task<GetSecretsResult> InvokeAsync(GetSecretsArgs args, InvokeOptions? opts = null)
        public static Output<GetSecretsResult> Invoke(GetSecretsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSecretsResult> getSecrets(GetSecretsArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: snowflake:index/getSecrets:getSecrets
      arguments:
        # arguments dictionary

    The following arguments are supported:

    In GetSecretsIn
    IN clause to filter the list of secrets
    Like string
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    WithDescribe bool
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    In GetSecretsIn
    IN clause to filter the list of secrets
    Like string
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    WithDescribe bool
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    in GetSecretsIn
    IN clause to filter the list of secrets
    like String
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    withDescribe Boolean
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    in GetSecretsIn
    IN clause to filter the list of secrets
    like string
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    withDescribe boolean
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    in_ GetSecretsIn
    IN clause to filter the list of secrets
    like str
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    with_describe bool
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    in Property Map
    IN clause to filter the list of secrets
    like String
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    withDescribe Boolean
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.

    getSecrets Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Secrets List<GetSecretsSecret>
    Holds the aggregated output of all secrets details queries.
    In GetSecretsIn
    IN clause to filter the list of secrets
    Like string
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    WithDescribe bool
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    Id string
    The provider-assigned unique ID for this managed resource.
    Secrets []GetSecretsSecret
    Holds the aggregated output of all secrets details queries.
    In GetSecretsIn
    IN clause to filter the list of secrets
    Like string
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    WithDescribe bool
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    id String
    The provider-assigned unique ID for this managed resource.
    secrets List<GetSecretsSecret>
    Holds the aggregated output of all secrets details queries.
    in GetSecretsIn
    IN clause to filter the list of secrets
    like String
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    withDescribe Boolean
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    id string
    The provider-assigned unique ID for this managed resource.
    secrets GetSecretsSecret[]
    Holds the aggregated output of all secrets details queries.
    in GetSecretsIn
    IN clause to filter the list of secrets
    like string
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    withDescribe boolean
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    id str
    The provider-assigned unique ID for this managed resource.
    secrets Sequence[GetSecretsSecret]
    Holds the aggregated output of all secrets details queries.
    in_ GetSecretsIn
    IN clause to filter the list of secrets
    like str
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    with_describe bool
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.
    id String
    The provider-assigned unique ID for this managed resource.
    secrets List<Property Map>
    Holds the aggregated output of all secrets details queries.
    in Property Map
    IN clause to filter the list of secrets
    like String
    Filters the output with case-insensitive pattern, with support for SQL wildcard characters (% and _).
    withDescribe Boolean
    Runs DESC SECRET for each secret returned by SHOW SECRETS. The output of describe is saved to the description field. By default this value is set to true.

    Supporting Types

    GetSecretsIn

    Account bool
    Returns records for the entire account.
    Application string
    Returns records for the specified application.
    ApplicationPackage string
    Returns records for the specified application package.
    Database string
    Returns records for the current database in use or for a specified database.
    Schema string
    Returns records for the current schema in use or a specified schema. Use fully qualified name.
    Account bool
    Returns records for the entire account.
    Application string
    Returns records for the specified application.
    ApplicationPackage string
    Returns records for the specified application package.
    Database string
    Returns records for the current database in use or for a specified database.
    Schema string
    Returns records for the current schema in use or a specified schema. Use fully qualified name.
    account Boolean
    Returns records for the entire account.
    application String
    Returns records for the specified application.
    applicationPackage String
    Returns records for the specified application package.
    database String
    Returns records for the current database in use or for a specified database.
    schema String
    Returns records for the current schema in use or a specified schema. Use fully qualified name.
    account boolean
    Returns records for the entire account.
    application string
    Returns records for the specified application.
    applicationPackage string
    Returns records for the specified application package.
    database string
    Returns records for the current database in use or for a specified database.
    schema string
    Returns records for the current schema in use or a specified schema. Use fully qualified name.
    account bool
    Returns records for the entire account.
    application str
    Returns records for the specified application.
    application_package str
    Returns records for the specified application package.
    database str
    Returns records for the current database in use or for a specified database.
    schema str
    Returns records for the current schema in use or a specified schema. Use fully qualified name.
    account Boolean
    Returns records for the entire account.
    application String
    Returns records for the specified application.
    applicationPackage String
    Returns records for the specified application package.
    database String
    Returns records for the current database in use or for a specified database.
    schema String
    Returns records for the current schema in use or a specified schema. Use fully qualified name.

    GetSecretsSecret

    DescribeOutputs List<GetSecretsSecretDescribeOutput>
    Holds the output of DESCRIBE SECRET.
    ShowOutputs List<GetSecretsSecretShowOutput>
    Holds the output of SHOW SECRETS.
    DescribeOutputs []GetSecretsSecretDescribeOutput
    Holds the output of DESCRIBE SECRET.
    ShowOutputs []GetSecretsSecretShowOutput
    Holds the output of SHOW SECRETS.
    describeOutputs List<GetSecretsSecretDescribeOutput>
    Holds the output of DESCRIBE SECRET.
    showOutputs List<GetSecretsSecretShowOutput>
    Holds the output of SHOW SECRETS.
    describeOutputs GetSecretsSecretDescribeOutput[]
    Holds the output of DESCRIBE SECRET.
    showOutputs GetSecretsSecretShowOutput[]
    Holds the output of SHOW SECRETS.
    describe_outputs Sequence[GetSecretsSecretDescribeOutput]
    Holds the output of DESCRIBE SECRET.
    show_outputs Sequence[GetSecretsSecretShowOutput]
    Holds the output of SHOW SECRETS.
    describeOutputs List<Property Map>
    Holds the output of DESCRIBE SECRET.
    showOutputs List<Property Map>
    Holds the output of SHOW SECRETS.

    GetSecretsSecretDescribeOutput

    GetSecretsSecretShowOutput

    Comment string
    CreatedOn string
    DatabaseName string
    Name string
    OauthScopes List<string>
    Owner string
    OwnerRoleType string
    SchemaName string
    SecretType string
    Comment string
    CreatedOn string
    DatabaseName string
    Name string
    OauthScopes []string
    Owner string
    OwnerRoleType string
    SchemaName string
    SecretType string
    comment String
    createdOn String
    databaseName String
    name String
    oauthScopes List<String>
    owner String
    ownerRoleType String
    schemaName String
    secretType String
    comment string
    createdOn string
    databaseName string
    name string
    oauthScopes string[]
    owner string
    ownerRoleType string
    schemaName string
    secretType string
    comment String
    createdOn String
    databaseName String
    name String
    oauthScopes List<String>
    owner String
    ownerRoleType String
    schemaName String
    secretType String

    Package Details

    Repository
    Snowflake pulumi/pulumi-snowflake
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the snowflake Terraform Provider.
    snowflake logo
    Snowflake v0.61.1 published on Thursday, Nov 14, 2024 by Pulumi