1. Packages
  2. Gcore Provider
  3. API Docs
  4. getSecret
gcore 0.22.0 published on Wednesday, Apr 30, 2025 by g-core

gcore.getSecret

Explore with Pulumi AI

gcore logo
gcore 0.22.0 published on Wednesday, Apr 30, 2025 by g-core

    Represent secret

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const pr = gcore.getProject({
        name: "test",
    });
    const rg = gcore.getRegion({
        name: "ED-10 Preprod",
    });
    const lbHttps = Promise.all([rg, pr]).then(([rg, pr]) => gcore.getSecret({
        name: "lb_https",
        regionId: rg.id,
        projectId: pr.id,
    }));
    export const view = lbHttps;
    
    import pulumi
    import pulumi_gcore as gcore
    
    pr = gcore.get_project(name="test")
    rg = gcore.get_region(name="ED-10 Preprod")
    lb_https = gcore.get_secret(name="lb_https",
        region_id=rg.id,
        project_id=pr.id)
    pulumi.export("view", lb_https)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/gcore/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		pr, err := gcore.GetProject(ctx, &gcore.GetProjectArgs{
    			Name: "test",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		rg, err := gcore.GetRegion(ctx, &gcore.GetRegionArgs{
    			Name: "ED-10 Preprod",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		lbHttps, err := gcore.LookupSecret(ctx, &gcore.LookupSecretArgs{
    			Name:      "lb_https",
    			RegionId:  pulumi.Float64Ref(rg.Id),
    			ProjectId: pulumi.Float64Ref(pr.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("view", lbHttps)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var pr = Gcore.GetProject.Invoke(new()
        {
            Name = "test",
        });
    
        var rg = Gcore.GetRegion.Invoke(new()
        {
            Name = "ED-10 Preprod",
        });
    
        var lbHttps = Gcore.GetSecret.Invoke(new()
        {
            Name = "lb_https",
            RegionId = rg.Apply(getRegionResult => getRegionResult.Id),
            ProjectId = pr.Apply(getProjectResult => getProjectResult.Id),
        });
    
        return new Dictionary<string, object?>
        {
            ["view"] = lbHttps,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.GcoreFunctions;
    import com.pulumi.gcore.inputs.GetProjectArgs;
    import com.pulumi.gcore.inputs.GetRegionArgs;
    import com.pulumi.gcore.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) {
            final var pr = GcoreFunctions.getProject(GetProjectArgs.builder()
                .name("test")
                .build());
    
            final var rg = GcoreFunctions.getRegion(GetRegionArgs.builder()
                .name("ED-10 Preprod")
                .build());
    
            final var lbHttps = GcoreFunctions.getSecret(GetSecretArgs.builder()
                .name("lb_https")
                .regionId(rg.applyValue(getRegionResult -> getRegionResult.id()))
                .projectId(pr.applyValue(getProjectResult -> getProjectResult.id()))
                .build());
    
            ctx.export("view", lbHttps.applyValue(getSecretResult -> getSecretResult));
        }
    }
    
    variables:
      pr:
        fn::invoke:
          function: gcore:getProject
          arguments:
            name: test
      rg:
        fn::invoke:
          function: gcore:getRegion
          arguments:
            name: ED-10 Preprod
      lbHttps:
        fn::invoke:
          function: gcore:getSecret
          arguments:
            name: lb_https
            regionId: ${rg.id}
            projectId: ${pr.id}
    outputs:
      view: ${lbHttps}
    

    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(id: Optional[str] = None,
                   name: Optional[str] = None,
                   project_id: Optional[float] = None,
                   project_name: Optional[str] = None,
                   region_id: Optional[float] = None,
                   region_name: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetSecretResult
    def get_secret_output(id: Optional[pulumi.Input[str]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   project_id: Optional[pulumi.Input[float]] = None,
                   project_name: Optional[pulumi.Input[str]] = None,
                   region_id: Optional[pulumi.Input[float]] = None,
                   region_name: 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)
    public static Output<GetSecretResult> getSecret(GetSecretArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcore:index/getSecret:getSecret
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Id string
    The ID of this resource.
    ProjectId double
    ProjectName string
    RegionId double
    RegionName string
    Name string
    Id string
    The ID of this resource.
    ProjectId float64
    ProjectName string
    RegionId float64
    RegionName string
    name String
    id String
    The ID of this resource.
    projectId Double
    projectName String
    regionId Double
    regionName String
    name string
    id string
    The ID of this resource.
    projectId number
    projectName string
    regionId number
    regionName string
    name str
    id str
    The ID of this resource.
    project_id float
    project_name str
    region_id float
    region_name str
    name String
    id String
    The ID of this resource.
    projectId Number
    projectName String
    regionId Number
    regionName String

    getSecret Result

    The following output properties are available:

    Algorithm string
    BitLength double
    ContentTypes Dictionary<string, string>
    Created string
    Datetime when the secret was created. The format is 2025-12-28T19:14:44.180394
    Expiration string
    Datetime when the secret will expire. The format is 2025-12-28T19:14:44.180394
    Id string
    The ID of this resource.
    Mode string
    Name string
    Status string
    ProjectId double
    ProjectName string
    RegionId double
    RegionName string
    Algorithm string
    BitLength float64
    ContentTypes map[string]string
    Created string
    Datetime when the secret was created. The format is 2025-12-28T19:14:44.180394
    Expiration string
    Datetime when the secret will expire. The format is 2025-12-28T19:14:44.180394
    Id string
    The ID of this resource.
    Mode string
    Name string
    Status string
    ProjectId float64
    ProjectName string
    RegionId float64
    RegionName string
    algorithm String
    bitLength Double
    contentTypes Map<String,String>
    created String
    Datetime when the secret was created. The format is 2025-12-28T19:14:44.180394
    expiration String
    Datetime when the secret will expire. The format is 2025-12-28T19:14:44.180394
    id String
    The ID of this resource.
    mode String
    name String
    status String
    projectId Double
    projectName String
    regionId Double
    regionName String
    algorithm string
    bitLength number
    contentTypes {[key: string]: string}
    created string
    Datetime when the secret was created. The format is 2025-12-28T19:14:44.180394
    expiration string
    Datetime when the secret will expire. The format is 2025-12-28T19:14:44.180394
    id string
    The ID of this resource.
    mode string
    name string
    status string
    projectId number
    projectName string
    regionId number
    regionName string
    algorithm str
    bit_length float
    content_types Mapping[str, str]
    created str
    Datetime when the secret was created. The format is 2025-12-28T19:14:44.180394
    expiration str
    Datetime when the secret will expire. The format is 2025-12-28T19:14:44.180394
    id str
    The ID of this resource.
    mode str
    name str
    status str
    project_id float
    project_name str
    region_id float
    region_name str
    algorithm String
    bitLength Number
    contentTypes Map<String>
    created String
    Datetime when the secret was created. The format is 2025-12-28T19:14:44.180394
    expiration String
    Datetime when the secret will expire. The format is 2025-12-28T19:14:44.180394
    id String
    The ID of this resource.
    mode String
    name String
    status String
    projectId Number
    projectName String
    regionId Number
    regionName String

    Package Details

    Repository
    gcore g-core/terraform-provider-gcore
    License
    Notes
    This Pulumi package is based on the gcore Terraform Provider.
    gcore logo
    gcore 0.22.0 published on Wednesday, Apr 30, 2025 by g-core