1. Packages
  2. Rancher2 Provider
  3. API Docs
  4. getSecret
Rancher 2 v7.1.1 published on Monday, Oct 7, 2024 by Pulumi

rancher2.getSecret

Explore with Pulumi AI

rancher2 logo
Rancher 2 v7.1.1 published on Monday, Oct 7, 2024 by Pulumi

    Use this data source to retrieve information about a Rancher v2 secret.

    Depending of the availability, there are 2 types of Rancher v2 secrets:

    • Project secret: Available to all namespaces in the project_id
    • Namespaced secret: Available to just namespace_id in the project_id

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as rancher2 from "@pulumi/rancher2";
    
    // Retrieve a rancher2 Project Secret
    const foo = rancher2.getSecret({
        name: "<name>",
        projectId: "<project_id>",
    });
    
    import pulumi
    import pulumi_rancher2 as rancher2
    
    # Retrieve a rancher2 Project Secret
    foo = rancher2.get_secret(name="<name>",
        project_id="<project_id>")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-rancher2/sdk/v7/go/rancher2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Retrieve a rancher2 Project Secret
    		_, err := rancher2.LookupSecret(ctx, &rancher2.LookupSecretArgs{
    			Name:      "<name>",
    			ProjectId: "<project_id>",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Rancher2 = Pulumi.Rancher2;
    
    return await Deployment.RunAsync(() => 
    {
        // Retrieve a rancher2 Project Secret
        var foo = Rancher2.GetSecret.Invoke(new()
        {
            Name = "<name>",
            ProjectId = "<project_id>",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.rancher2.Rancher2Functions;
    import com.pulumi.rancher2.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) {
            // Retrieve a rancher2 Project Secret
            final var foo = Rancher2Functions.getSecret(GetSecretArgs.builder()
                .name("<name>")
                .projectId("<project_id>")
                .build());
    
        }
    }
    
    variables:
      # Retrieve a rancher2 Project Secret
      foo:
        fn::invoke:
          Function: rancher2:getSecret
          Arguments:
            name: <name>
            projectId: <project_id>
    
    import * as pulumi from "@pulumi/pulumi";
    import * as rancher2 from "@pulumi/rancher2";
    
    // Retrieve a rancher2 Namespaced Secret
    const foo = rancher2.getSecret({
        name: "<name>",
        projectId: "<project_id>",
        namespaceId: "<namespace_id>",
    });
    
    import pulumi
    import pulumi_rancher2 as rancher2
    
    # Retrieve a rancher2 Namespaced Secret
    foo = rancher2.get_secret(name="<name>",
        project_id="<project_id>",
        namespace_id="<namespace_id>")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-rancher2/sdk/v7/go/rancher2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Retrieve a rancher2 Namespaced Secret
    		_, err := rancher2.LookupSecret(ctx, &rancher2.LookupSecretArgs{
    			Name:        "<name>",
    			ProjectId:   "<project_id>",
    			NamespaceId: pulumi.StringRef("<namespace_id>"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Rancher2 = Pulumi.Rancher2;
    
    return await Deployment.RunAsync(() => 
    {
        // Retrieve a rancher2 Namespaced Secret
        var foo = Rancher2.GetSecret.Invoke(new()
        {
            Name = "<name>",
            ProjectId = "<project_id>",
            NamespaceId = "<namespace_id>",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.rancher2.Rancher2Functions;
    import com.pulumi.rancher2.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) {
            // Retrieve a rancher2 Namespaced Secret
            final var foo = Rancher2Functions.getSecret(GetSecretArgs.builder()
                .name("<name>")
                .projectId("<project_id>")
                .namespaceId("<namespace_id>")
                .build());
    
        }
    }
    
    variables:
      # Retrieve a rancher2 Namespaced Secret
      foo:
        fn::invoke:
          Function: rancher2:getSecret
          Arguments:
            name: <name>
            projectId: <project_id>
            namespaceId: <namespace_id>
    

    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>
    def get_secret(name: Optional[str] = None,
                   namespace_id: Optional[str] = None,
                   project_id: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetSecretResult
    def get_secret_output(name: Optional[pulumi.Input[str]] = None,
                   namespace_id: Optional[pulumi.Input[str]] = None,
                   project_id: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetSecretResult]
    func LookupSecret(ctx *Context, args *LookupSecretArgs, opts ...InvokeOption) (*LookupSecretResult, error)
    func LookupSecretOutput(ctx *Context, args *LookupSecretOutputArgs, opts ...InvokeOption) LookupSecretResultOutput

    > 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)
    }
    public static CompletableFuture<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: rancher2:index/getSecret:getSecret
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the secret (string)
    ProjectId string
    The project id where to assign the secret (string)
    NamespaceId string
    The namespace id where to assign the namespaced secret (string)
    Name string
    The name of the secret (string)
    ProjectId string
    The project id where to assign the secret (string)
    NamespaceId string
    The namespace id where to assign the namespaced secret (string)
    name String
    The name of the secret (string)
    projectId String
    The project id where to assign the secret (string)
    namespaceId String
    The namespace id where to assign the namespaced secret (string)
    name string
    The name of the secret (string)
    projectId string
    The project id where to assign the secret (string)
    namespaceId string
    The namespace id where to assign the namespaced secret (string)
    name str
    The name of the secret (string)
    project_id str
    The project id where to assign the secret (string)
    namespace_id str
    The namespace id where to assign the namespaced secret (string)
    name String
    The name of the secret (string)
    projectId String
    The project id where to assign the secret (string)
    namespaceId String
    The namespace id where to assign the namespaced secret (string)

    getSecret Result

    The following output properties are available:

    Annotations Dictionary<string, string>
    (Computed) Annotations for secret object (map)
    Data Dictionary<string, string>
    (Computed) Secret key/value data. Base64 encoding required for values (map)
    Description string
    (Computed) A secret description (string)
    Id string
    The provider-assigned unique ID for this managed resource.
    Labels Dictionary<string, string>
    (Computed) Labels for secret object (map)
    Name string
    ProjectId string
    NamespaceId string
    Annotations map[string]string
    (Computed) Annotations for secret object (map)
    Data map[string]string
    (Computed) Secret key/value data. Base64 encoding required for values (map)
    Description string
    (Computed) A secret description (string)
    Id string
    The provider-assigned unique ID for this managed resource.
    Labels map[string]string
    (Computed) Labels for secret object (map)
    Name string
    ProjectId string
    NamespaceId string
    annotations Map<String,String>
    (Computed) Annotations for secret object (map)
    data Map<String,String>
    (Computed) Secret key/value data. Base64 encoding required for values (map)
    description String
    (Computed) A secret description (string)
    id String
    The provider-assigned unique ID for this managed resource.
    labels Map<String,String>
    (Computed) Labels for secret object (map)
    name String
    projectId String
    namespaceId String
    annotations {[key: string]: string}
    (Computed) Annotations for secret object (map)
    data {[key: string]: string}
    (Computed) Secret key/value data. Base64 encoding required for values (map)
    description string
    (Computed) A secret description (string)
    id string
    The provider-assigned unique ID for this managed resource.
    labels {[key: string]: string}
    (Computed) Labels for secret object (map)
    name string
    projectId string
    namespaceId string
    annotations Mapping[str, str]
    (Computed) Annotations for secret object (map)
    data Mapping[str, str]
    (Computed) Secret key/value data. Base64 encoding required for values (map)
    description str
    (Computed) A secret description (string)
    id str
    The provider-assigned unique ID for this managed resource.
    labels Mapping[str, str]
    (Computed) Labels for secret object (map)
    name str
    project_id str
    namespace_id str
    annotations Map<String>
    (Computed) Annotations for secret object (map)
    data Map<String>
    (Computed) Secret key/value data. Base64 encoding required for values (map)
    description String
    (Computed) A secret description (string)
    id String
    The provider-assigned unique ID for this managed resource.
    labels Map<String>
    (Computed) Labels for secret object (map)
    name String
    projectId String
    namespaceId String

    Package Details

    Repository
    Rancher2 pulumi/pulumi-rancher2
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the rancher2 Terraform Provider.
    rancher2 logo
    Rancher 2 v7.1.1 published on Monday, Oct 7, 2024 by Pulumi