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

gcore.getLoadbalancerv2

Explore with Pulumi AI

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const project = gcore.getProject({
        name: "Default",
    });
    const region = gcore.getRegion({
        name: "Luxembourg-2",
    });
    const lb = Promise.all([region, project]).then(([region, project]) => gcore.getLoadbalancerv2({
        regionId: region.id,
        projectId: project.id,
        name: "test-lb",
    }));
    export const view = lb;
    export const lbIp = lb.then(lb => lb.vipAddress);
    
    import pulumi
    import pulumi_gcore as gcore
    
    project = gcore.get_project(name="Default")
    region = gcore.get_region(name="Luxembourg-2")
    lb = gcore.get_loadbalancerv2(region_id=region.id,
        project_id=project.id,
        name="test-lb")
    pulumi.export("view", lb)
    pulumi.export("lbIp", lb.vip_address)
    
    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 {
    		project, err := gcore.GetProject(ctx, &gcore.GetProjectArgs{
    			Name: "Default",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		region, err := gcore.GetRegion(ctx, &gcore.GetRegionArgs{
    			Name: "Luxembourg-2",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		lb, err := gcore.LookupLoadbalancerv2(ctx, &gcore.LookupLoadbalancerv2Args{
    			RegionId:  pulumi.Float64Ref(region.Id),
    			ProjectId: pulumi.Float64Ref(project.Id),
    			Name:      "test-lb",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("view", lb)
    		ctx.Export("lbIp", lb.VipAddress)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var project = Gcore.GetProject.Invoke(new()
        {
            Name = "Default",
        });
    
        var region = Gcore.GetRegion.Invoke(new()
        {
            Name = "Luxembourg-2",
        });
    
        var lb = Gcore.GetLoadbalancerv2.Invoke(new()
        {
            RegionId = region.Apply(getRegionResult => getRegionResult.Id),
            ProjectId = project.Apply(getProjectResult => getProjectResult.Id),
            Name = "test-lb",
        });
    
        return new Dictionary<string, object?>
        {
            ["view"] = lb,
            ["lbIp"] = lb.Apply(getLoadbalancerv2Result => getLoadbalancerv2Result.VipAddress),
        };
    });
    
    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.GetLoadbalancerv2Args;
    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 project = GcoreFunctions.getProject(GetProjectArgs.builder()
                .name("Default")
                .build());
    
            final var region = GcoreFunctions.getRegion(GetRegionArgs.builder()
                .name("Luxembourg-2")
                .build());
    
            final var lb = GcoreFunctions.getLoadbalancerv2(GetLoadbalancerv2Args.builder()
                .regionId(region.applyValue(getRegionResult -> getRegionResult.id()))
                .projectId(project.applyValue(getProjectResult -> getProjectResult.id()))
                .name("test-lb")
                .build());
    
            ctx.export("view", lb.applyValue(getLoadbalancerv2Result -> getLoadbalancerv2Result));
            ctx.export("lbIp", lb.applyValue(getLoadbalancerv2Result -> getLoadbalancerv2Result.vipAddress()));
        }
    }
    
    variables:
      project:
        fn::invoke:
          function: gcore:getProject
          arguments:
            name: Default
      region:
        fn::invoke:
          function: gcore:getRegion
          arguments:
            name: Luxembourg-2
      lb:
        fn::invoke:
          function: gcore:getLoadbalancerv2
          arguments:
            regionId: ${region.id}
            projectId: ${project.id}
            name: test-lb
    outputs:
      view: ${lb}
      lbIp: ${lb.vipAddress}
    

    Using getLoadbalancerv2

    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 getLoadbalancerv2(args: GetLoadbalancerv2Args, opts?: InvokeOptions): Promise<GetLoadbalancerv2Result>
    function getLoadbalancerv2Output(args: GetLoadbalancerv2OutputArgs, opts?: InvokeOptions): Output<GetLoadbalancerv2Result>
    def get_loadbalancerv2(id: Optional[str] = None,
                           metadata_k: Optional[str] = None,
                           metadata_kv: Optional[Mapping[str, 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,
                           vip_ip_family: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetLoadbalancerv2Result
    def get_loadbalancerv2_output(id: Optional[pulumi.Input[str]] = None,
                           metadata_k: Optional[pulumi.Input[str]] = None,
                           metadata_kv: Optional[pulumi.Input[Mapping[str, 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,
                           vip_ip_family: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetLoadbalancerv2Result]
    func LookupLoadbalancerv2(ctx *Context, args *LookupLoadbalancerv2Args, opts ...InvokeOption) (*LookupLoadbalancerv2Result, error)
    func LookupLoadbalancerv2Output(ctx *Context, args *LookupLoadbalancerv2OutputArgs, opts ...InvokeOption) LookupLoadbalancerv2ResultOutput

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

    public static class GetLoadbalancerv2 
    {
        public static Task<GetLoadbalancerv2Result> InvokeAsync(GetLoadbalancerv2Args args, InvokeOptions? opts = null)
        public static Output<GetLoadbalancerv2Result> Invoke(GetLoadbalancerv2InvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLoadbalancerv2Result> getLoadbalancerv2(GetLoadbalancerv2Args args, InvokeOptions options)
    public static Output<GetLoadbalancerv2Result> getLoadbalancerv2(GetLoadbalancerv2Args args, InvokeOptions options)
    
    fn::invoke:
      function: gcore:index/getLoadbalancerv2:getLoadbalancerv2
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the load balancer.
    Id string
    The ID of this resource.
    MetadataK string
    Metadata string of the load balancer.
    MetadataKv Dictionary<string, string>
    Metadata map of the load balancer.
    ProjectId double
    ID of the project in which load balancer was created.
    ProjectName string
    Name of the project in which load balancer was created.
    RegionId double
    ID of the region in which load balancer was created.
    RegionName string
    Name of the region in which load balancer was created.
    VipIpFamily string
    Available values are 'ipv4', 'ipv6', 'dual'
    Name string
    Name of the load balancer.
    Id string
    The ID of this resource.
    MetadataK string
    Metadata string of the load balancer.
    MetadataKv map[string]string
    Metadata map of the load balancer.
    ProjectId float64
    ID of the project in which load balancer was created.
    ProjectName string
    Name of the project in which load balancer was created.
    RegionId float64
    ID of the region in which load balancer was created.
    RegionName string
    Name of the region in which load balancer was created.
    VipIpFamily string
    Available values are 'ipv4', 'ipv6', 'dual'
    name String
    Name of the load balancer.
    id String
    The ID of this resource.
    metadataK String
    Metadata string of the load balancer.
    metadataKv Map<String,String>
    Metadata map of the load balancer.
    projectId Double
    ID of the project in which load balancer was created.
    projectName String
    Name of the project in which load balancer was created.
    regionId Double
    ID of the region in which load balancer was created.
    regionName String
    Name of the region in which load balancer was created.
    vipIpFamily String
    Available values are 'ipv4', 'ipv6', 'dual'
    name string
    Name of the load balancer.
    id string
    The ID of this resource.
    metadataK string
    Metadata string of the load balancer.
    metadataKv {[key: string]: string}
    Metadata map of the load balancer.
    projectId number
    ID of the project in which load balancer was created.
    projectName string
    Name of the project in which load balancer was created.
    regionId number
    ID of the region in which load balancer was created.
    regionName string
    Name of the region in which load balancer was created.
    vipIpFamily string
    Available values are 'ipv4', 'ipv6', 'dual'
    name str
    Name of the load balancer.
    id str
    The ID of this resource.
    metadata_k str
    Metadata string of the load balancer.
    metadata_kv Mapping[str, str]
    Metadata map of the load balancer.
    project_id float
    ID of the project in which load balancer was created.
    project_name str
    Name of the project in which load balancer was created.
    region_id float
    ID of the region in which load balancer was created.
    region_name str
    Name of the region in which load balancer was created.
    vip_ip_family str
    Available values are 'ipv4', 'ipv6', 'dual'
    name String
    Name of the load balancer.
    id String
    The ID of this resource.
    metadataK String
    Metadata string of the load balancer.
    metadataKv Map<String>
    Metadata map of the load balancer.
    projectId Number
    ID of the project in which load balancer was created.
    projectName String
    Name of the project in which load balancer was created.
    regionId Number
    ID of the region in which load balancer was created.
    regionName String
    Name of the region in which load balancer was created.
    vipIpFamily String
    Available values are 'ipv4', 'ipv6', 'dual'

    getLoadbalancerv2 Result

    The following output properties are available:

    AdditionalVips List<GetLoadbalancerv2AdditionalVip>
    Load Balancer additional VIPs
    Id string
    The ID of this resource.
    MetadataReadOnlies List<GetLoadbalancerv2MetadataReadOnly>
    List of metadata items.
    Name string
    Name of the load balancer.
    PreferredConnectivity string
    Available values are 'L2', 'L3'
    VipAddress string
    Load balancer IP address.
    VipIpFamily string
    Available values are 'ipv4', 'ipv6', 'dual'
    VipPortId string
    Load balancer Port ID.
    VrrpIps List<GetLoadbalancerv2VrrpIp>
    MetadataK string
    Metadata string of the load balancer.
    MetadataKv Dictionary<string, string>
    Metadata map of the load balancer.
    ProjectId double
    ID of the project in which load balancer was created.
    ProjectName string
    Name of the project in which load balancer was created.
    RegionId double
    ID of the region in which load balancer was created.
    RegionName string
    Name of the region in which load balancer was created.
    AdditionalVips []GetLoadbalancerv2AdditionalVip
    Load Balancer additional VIPs
    Id string
    The ID of this resource.
    MetadataReadOnlies []GetLoadbalancerv2MetadataReadOnly
    List of metadata items.
    Name string
    Name of the load balancer.
    PreferredConnectivity string
    Available values are 'L2', 'L3'
    VipAddress string
    Load balancer IP address.
    VipIpFamily string
    Available values are 'ipv4', 'ipv6', 'dual'
    VipPortId string
    Load balancer Port ID.
    VrrpIps []GetLoadbalancerv2VrrpIp
    MetadataK string
    Metadata string of the load balancer.
    MetadataKv map[string]string
    Metadata map of the load balancer.
    ProjectId float64
    ID of the project in which load balancer was created.
    ProjectName string
    Name of the project in which load balancer was created.
    RegionId float64
    ID of the region in which load balancer was created.
    RegionName string
    Name of the region in which load balancer was created.
    additionalVips List<GetLoadbalancerv2AdditionalVip>
    Load Balancer additional VIPs
    id String
    The ID of this resource.
    metadataReadOnlies List<GetLoadbalancerv2MetadataReadOnly>
    List of metadata items.
    name String
    Name of the load balancer.
    preferredConnectivity String
    Available values are 'L2', 'L3'
    vipAddress String
    Load balancer IP address.
    vipIpFamily String
    Available values are 'ipv4', 'ipv6', 'dual'
    vipPortId String
    Load balancer Port ID.
    vrrpIps List<GetLoadbalancerv2VrrpIp>
    metadataK String
    Metadata string of the load balancer.
    metadataKv Map<String,String>
    Metadata map of the load balancer.
    projectId Double
    ID of the project in which load balancer was created.
    projectName String
    Name of the project in which load balancer was created.
    regionId Double
    ID of the region in which load balancer was created.
    regionName String
    Name of the region in which load balancer was created.
    additionalVips GetLoadbalancerv2AdditionalVip[]
    Load Balancer additional VIPs
    id string
    The ID of this resource.
    metadataReadOnlies GetLoadbalancerv2MetadataReadOnly[]
    List of metadata items.
    name string
    Name of the load balancer.
    preferredConnectivity string
    Available values are 'L2', 'L3'
    vipAddress string
    Load balancer IP address.
    vipIpFamily string
    Available values are 'ipv4', 'ipv6', 'dual'
    vipPortId string
    Load balancer Port ID.
    vrrpIps GetLoadbalancerv2VrrpIp[]
    metadataK string
    Metadata string of the load balancer.
    metadataKv {[key: string]: string}
    Metadata map of the load balancer.
    projectId number
    ID of the project in which load balancer was created.
    projectName string
    Name of the project in which load balancer was created.
    regionId number
    ID of the region in which load balancer was created.
    regionName string
    Name of the region in which load balancer was created.
    additional_vips Sequence[GetLoadbalancerv2AdditionalVip]
    Load Balancer additional VIPs
    id str
    The ID of this resource.
    metadata_read_onlies Sequence[GetLoadbalancerv2MetadataReadOnly]
    List of metadata items.
    name str
    Name of the load balancer.
    preferred_connectivity str
    Available values are 'L2', 'L3'
    vip_address str
    Load balancer IP address.
    vip_ip_family str
    Available values are 'ipv4', 'ipv6', 'dual'
    vip_port_id str
    Load balancer Port ID.
    vrrp_ips Sequence[GetLoadbalancerv2VrrpIp]
    metadata_k str
    Metadata string of the load balancer.
    metadata_kv Mapping[str, str]
    Metadata map of the load balancer.
    project_id float
    ID of the project in which load balancer was created.
    project_name str
    Name of the project in which load balancer was created.
    region_id float
    ID of the region in which load balancer was created.
    region_name str
    Name of the region in which load balancer was created.
    additionalVips List<Property Map>
    Load Balancer additional VIPs
    id String
    The ID of this resource.
    metadataReadOnlies List<Property Map>
    List of metadata items.
    name String
    Name of the load balancer.
    preferredConnectivity String
    Available values are 'L2', 'L3'
    vipAddress String
    Load balancer IP address.
    vipIpFamily String
    Available values are 'ipv4', 'ipv6', 'dual'
    vipPortId String
    Load balancer Port ID.
    vrrpIps List<Property Map>
    metadataK String
    Metadata string of the load balancer.
    metadataKv Map<String>
    Metadata map of the load balancer.
    projectId Number
    ID of the project in which load balancer was created.
    projectName String
    Name of the project in which load balancer was created.
    regionId Number
    ID of the region in which load balancer was created.
    regionName String
    Name of the region in which load balancer was created.

    Supporting Types

    GetLoadbalancerv2AdditionalVip

    IpAddress string
    SubnetId string
    IpAddress string
    SubnetId string
    ipAddress String
    subnetId String
    ipAddress string
    subnetId string
    ipAddress String
    subnetId String

    GetLoadbalancerv2MetadataReadOnly

    Key string
    ReadOnly bool
    Value string
    Key string
    ReadOnly bool
    Value string
    key String
    readOnly Boolean
    value String
    key string
    readOnly boolean
    value string
    key str
    read_only bool
    value str
    key String
    readOnly Boolean
    value String

    GetLoadbalancerv2VrrpIp

    IpAddress string
    SubnetId string
    IpAddress string
    SubnetId string
    ipAddress String
    subnetId String
    ipAddress string
    subnetId string
    ipAddress String
    subnetId 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