1. Packages
  2. Gcorelabs Provider
  3. API Docs
  4. Loadbalancer
gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core

gcorelabs.Loadbalancer

Explore with Pulumi AI

gcorelabs logo
gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core

    Represent load balancer

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcore from "@pulumi/gcore";
    
    const lb = new gcore.index.Gcore_loadbalancer("lb", {
        projectId: 1,
        regionId: 1,
        name: "test",
        flavor: "lb1-1-2",
        listener: [{
            name: "test",
            protocol: "HTTP",
            protocolPort: 80,
        }],
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    lb = gcore.index.Gcore_loadbalancer("lb",
        project_id=1,
        region_id=1,
        name=test,
        flavor=lb1-1-2,
        listener=[{
            name: test,
            protocol: HTTP,
            protocolPort: 80,
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcore/sdk/go/gcore"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gcore.NewGcore_loadbalancer(ctx, "lb", &gcore.Gcore_loadbalancerArgs{
    			ProjectId: 1,
    			RegionId:  1,
    			Name:      "test",
    			Flavor:    "lb1-1-2",
    			Listener: []map[string]interface{}{
    				map[string]interface{}{
    					"name":         "test",
    					"protocol":     "HTTP",
    					"protocolPort": 80,
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcore = Pulumi.Gcore;
    
    return await Deployment.RunAsync(() => 
    {
        var lb = new Gcore.Index.Gcore_loadbalancer("lb", new()
        {
            ProjectId = 1,
            RegionId = 1,
            Name = "test",
            Flavor = "lb1-1-2",
            Listener = new[]
            {
                
                {
                    { "name", "test" },
                    { "protocol", "HTTP" },
                    { "protocolPort", 80 },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.gcore_loadbalancer;
    import com.pulumi.gcore.Gcore_loadbalancerArgs;
    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 lb = new Gcore_loadbalancer("lb", Gcore_loadbalancerArgs.builder()
                .projectId(1)
                .regionId(1)
                .name("test")
                .flavor("lb1-1-2")
                .listener(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
                .build());
    
        }
    }
    
    resources:
      lb:
        type: gcore:gcore_loadbalancer
        properties:
          projectId: 1
          regionId: 1
          name: test
          flavor: lb1-1-2
          # when upgrading to version 0.2.28 nested listener max length reduced to 1
          #   //that mean, if you had more than one nested listener and removed them from
          #   //schema they not delete in the cloud. User has to delete it manually and
          #   //recreate as gcore_lblistener resource
          listener:
            - name: test
              protocol: HTTP
              protocolPort: 80
    

    Create Loadbalancer Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Loadbalancer(name: string, args: LoadbalancerArgs, opts?: CustomResourceOptions);
    @overload
    def Loadbalancer(resource_name: str,
                     args: LoadbalancerArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def Loadbalancer(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     listener: Optional[LoadbalancerListenerArgs] = None,
                     project_id: Optional[float] = None,
                     last_updated: Optional[str] = None,
                     loadbalancer_id: Optional[str] = None,
                     metadata_map: Optional[Mapping[str, str]] = None,
                     name: Optional[str] = None,
                     flavor: Optional[str] = None,
                     project_name: Optional[str] = None,
                     region_id: Optional[float] = None,
                     region_name: Optional[str] = None,
                     timeouts: Optional[LoadbalancerTimeoutsArgs] = None,
                     vip_network_id: Optional[str] = None,
                     vip_subnet_id: Optional[str] = None)
    func NewLoadbalancer(ctx *Context, name string, args LoadbalancerArgs, opts ...ResourceOption) (*Loadbalancer, error)
    public Loadbalancer(string name, LoadbalancerArgs args, CustomResourceOptions? opts = null)
    public Loadbalancer(String name, LoadbalancerArgs args)
    public Loadbalancer(String name, LoadbalancerArgs args, CustomResourceOptions options)
    
    type: gcorelabs:Loadbalancer
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args LoadbalancerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args LoadbalancerArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args LoadbalancerArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LoadbalancerArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LoadbalancerArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var loadbalancerResource = new Gcorelabs.Loadbalancer("loadbalancerResource", new()
    {
        Listener = new Gcorelabs.Inputs.LoadbalancerListenerArgs
        {
            Name = "string",
            Protocol = "string",
            ProtocolPort = 0,
            Certificate = "string",
            CertificateChain = "string",
            Id = "string",
            InsertXForwarded = false,
            PrivateKey = "string",
            SecretId = "string",
            SniSecretIds = new[]
            {
                "string",
            },
        },
        ProjectId = 0,
        LastUpdated = "string",
        LoadbalancerId = "string",
        MetadataMap = 
        {
            { "string", "string" },
        },
        Name = "string",
        Flavor = "string",
        ProjectName = "string",
        RegionId = 0,
        RegionName = "string",
        Timeouts = new Gcorelabs.Inputs.LoadbalancerTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
        },
        VipNetworkId = "string",
        VipSubnetId = "string",
    });
    
    example, err := gcorelabs.NewLoadbalancer(ctx, "loadbalancerResource", &gcorelabs.LoadbalancerArgs{
    	Listener: &gcorelabs.LoadbalancerListenerArgs{
    		Name:             pulumi.String("string"),
    		Protocol:         pulumi.String("string"),
    		ProtocolPort:     pulumi.Float64(0),
    		Certificate:      pulumi.String("string"),
    		CertificateChain: pulumi.String("string"),
    		Id:               pulumi.String("string"),
    		InsertXForwarded: pulumi.Bool(false),
    		PrivateKey:       pulumi.String("string"),
    		SecretId:         pulumi.String("string"),
    		SniSecretIds: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	ProjectId:      pulumi.Float64(0),
    	LastUpdated:    pulumi.String("string"),
    	LoadbalancerId: pulumi.String("string"),
    	MetadataMap: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Name:        pulumi.String("string"),
    	Flavor:      pulumi.String("string"),
    	ProjectName: pulumi.String("string"),
    	RegionId:    pulumi.Float64(0),
    	RegionName:  pulumi.String("string"),
    	Timeouts: &gcorelabs.LoadbalancerTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    	},
    	VipNetworkId: pulumi.String("string"),
    	VipSubnetId:  pulumi.String("string"),
    })
    
    var loadbalancerResource = new Loadbalancer("loadbalancerResource", LoadbalancerArgs.builder()
        .listener(LoadbalancerListenerArgs.builder()
            .name("string")
            .protocol("string")
            .protocolPort(0)
            .certificate("string")
            .certificateChain("string")
            .id("string")
            .insertXForwarded(false)
            .privateKey("string")
            .secretId("string")
            .sniSecretIds("string")
            .build())
        .projectId(0)
        .lastUpdated("string")
        .loadbalancerId("string")
        .metadataMap(Map.of("string", "string"))
        .name("string")
        .flavor("string")
        .projectName("string")
        .regionId(0)
        .regionName("string")
        .timeouts(LoadbalancerTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .build())
        .vipNetworkId("string")
        .vipSubnetId("string")
        .build());
    
    loadbalancer_resource = gcorelabs.Loadbalancer("loadbalancerResource",
        listener={
            "name": "string",
            "protocol": "string",
            "protocol_port": 0,
            "certificate": "string",
            "certificate_chain": "string",
            "id": "string",
            "insert_x_forwarded": False,
            "private_key": "string",
            "secret_id": "string",
            "sni_secret_ids": ["string"],
        },
        project_id=0,
        last_updated="string",
        loadbalancer_id="string",
        metadata_map={
            "string": "string",
        },
        name="string",
        flavor="string",
        project_name="string",
        region_id=0,
        region_name="string",
        timeouts={
            "create": "string",
            "delete": "string",
        },
        vip_network_id="string",
        vip_subnet_id="string")
    
    const loadbalancerResource = new gcorelabs.Loadbalancer("loadbalancerResource", {
        listener: {
            name: "string",
            protocol: "string",
            protocolPort: 0,
            certificate: "string",
            certificateChain: "string",
            id: "string",
            insertXForwarded: false,
            privateKey: "string",
            secretId: "string",
            sniSecretIds: ["string"],
        },
        projectId: 0,
        lastUpdated: "string",
        loadbalancerId: "string",
        metadataMap: {
            string: "string",
        },
        name: "string",
        flavor: "string",
        projectName: "string",
        regionId: 0,
        regionName: "string",
        timeouts: {
            create: "string",
            "delete": "string",
        },
        vipNetworkId: "string",
        vipSubnetId: "string",
    });
    
    type: gcorelabs:Loadbalancer
    properties:
        flavor: string
        lastUpdated: string
        listener:
            certificate: string
            certificateChain: string
            id: string
            insertXForwarded: false
            name: string
            privateKey: string
            protocol: string
            protocolPort: 0
            secretId: string
            sniSecretIds:
                - string
        loadbalancerId: string
        metadataMap:
            string: string
        name: string
        projectId: 0
        projectName: string
        regionId: 0
        regionName: string
        timeouts:
            create: string
            delete: string
        vipNetworkId: string
        vipSubnetId: string
    

    Loadbalancer Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The Loadbalancer resource accepts the following input properties:

    Listener LoadbalancerListener
    Flavor string
    LastUpdated string
    LoadbalancerId string
    The ID of this resource.
    MetadataMap Dictionary<string, string>
    Name string
    ProjectId double
    ProjectName string
    RegionId double
    RegionName string
    Timeouts LoadbalancerTimeouts
    VipNetworkId string
    VipSubnetId string
    Listener LoadbalancerListenerArgs
    Flavor string
    LastUpdated string
    LoadbalancerId string
    The ID of this resource.
    MetadataMap map[string]string
    Name string
    ProjectId float64
    ProjectName string
    RegionId float64
    RegionName string
    Timeouts LoadbalancerTimeoutsArgs
    VipNetworkId string
    VipSubnetId string
    listener LoadbalancerListener
    flavor String
    lastUpdated String
    loadbalancerId String
    The ID of this resource.
    metadataMap Map<String,String>
    name String
    projectId Double
    projectName String
    regionId Double
    regionName String
    timeouts LoadbalancerTimeouts
    vipNetworkId String
    vipSubnetId String
    listener LoadbalancerListener
    flavor string
    lastUpdated string
    loadbalancerId string
    The ID of this resource.
    metadataMap {[key: string]: string}
    name string
    projectId number
    projectName string
    regionId number
    regionName string
    timeouts LoadbalancerTimeouts
    vipNetworkId string
    vipSubnetId string
    listener Property Map
    flavor String
    lastUpdated String
    loadbalancerId String
    The ID of this resource.
    metadataMap Map<String>
    name String
    projectId Number
    projectName String
    regionId Number
    regionName String
    timeouts Property Map
    vipNetworkId String
    vipSubnetId String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Loadbalancer resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    MetadataReadOnlies List<LoadbalancerMetadataReadOnly>
    VipAddress string
    Load balancer IP address
    Id string
    The provider-assigned unique ID for this managed resource.
    MetadataReadOnlies []LoadbalancerMetadataReadOnly
    VipAddress string
    Load balancer IP address
    id String
    The provider-assigned unique ID for this managed resource.
    metadataReadOnlies List<LoadbalancerMetadataReadOnly>
    vipAddress String
    Load balancer IP address
    id string
    The provider-assigned unique ID for this managed resource.
    metadataReadOnlies LoadbalancerMetadataReadOnly[]
    vipAddress string
    Load balancer IP address
    id str
    The provider-assigned unique ID for this managed resource.
    metadata_read_onlies Sequence[LoadbalancerMetadataReadOnly]
    vip_address str
    Load balancer IP address
    id String
    The provider-assigned unique ID for this managed resource.
    metadataReadOnlies List<Property Map>
    vipAddress String
    Load balancer IP address

    Look up Existing Loadbalancer Resource

    Get an existing Loadbalancer resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: LoadbalancerState, opts?: CustomResourceOptions): Loadbalancer
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            flavor: Optional[str] = None,
            last_updated: Optional[str] = None,
            listener: Optional[LoadbalancerListenerArgs] = None,
            loadbalancer_id: Optional[str] = None,
            metadata_map: Optional[Mapping[str, str]] = None,
            metadata_read_onlies: Optional[Sequence[LoadbalancerMetadataReadOnlyArgs]] = 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,
            timeouts: Optional[LoadbalancerTimeoutsArgs] = None,
            vip_address: Optional[str] = None,
            vip_network_id: Optional[str] = None,
            vip_subnet_id: Optional[str] = None) -> Loadbalancer
    func GetLoadbalancer(ctx *Context, name string, id IDInput, state *LoadbalancerState, opts ...ResourceOption) (*Loadbalancer, error)
    public static Loadbalancer Get(string name, Input<string> id, LoadbalancerState? state, CustomResourceOptions? opts = null)
    public static Loadbalancer get(String name, Output<String> id, LoadbalancerState state, CustomResourceOptions options)
    resources:  _:    type: gcorelabs:Loadbalancer    get:      id: ${id}
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Flavor string
    LastUpdated string
    Listener LoadbalancerListener
    LoadbalancerId string
    The ID of this resource.
    MetadataMap Dictionary<string, string>
    MetadataReadOnlies List<LoadbalancerMetadataReadOnly>
    Name string
    ProjectId double
    ProjectName string
    RegionId double
    RegionName string
    Timeouts LoadbalancerTimeouts
    VipAddress string
    Load balancer IP address
    VipNetworkId string
    VipSubnetId string
    flavor string
    lastUpdated string
    listener LoadbalancerListener
    loadbalancerId string
    The ID of this resource.
    metadataMap {[key: string]: string}
    metadataReadOnlies LoadbalancerMetadataReadOnly[]
    name string
    projectId number
    projectName string
    regionId number
    regionName string
    timeouts LoadbalancerTimeouts
    vipAddress string
    Load balancer IP address
    vipNetworkId string
    vipSubnetId string
    flavor String
    lastUpdated String
    listener Property Map
    loadbalancerId String
    The ID of this resource.
    metadataMap Map<String>
    metadataReadOnlies List<Property Map>
    name String
    projectId Number
    projectName String
    regionId Number
    regionName String
    timeouts Property Map
    vipAddress String
    Load balancer IP address
    vipNetworkId String
    vipSubnetId String

    Supporting Types

    LoadbalancerListener, LoadbalancerListenerArgs

    Name string
    Protocol string
    Available values is 'HTTP' (currently work, other do not work on ed-8), 'HTTPS', 'TCP', 'UDP'
    ProtocolPort double
    Certificate string
    CertificateChain string
    Id string
    The ID of this resource.
    InsertXForwarded bool
    PrivateKey string
    SecretId string
    SniSecretIds List<string>
    Name string
    Protocol string
    Available values is 'HTTP' (currently work, other do not work on ed-8), 'HTTPS', 'TCP', 'UDP'
    ProtocolPort float64
    Certificate string
    CertificateChain string
    Id string
    The ID of this resource.
    InsertXForwarded bool
    PrivateKey string
    SecretId string
    SniSecretIds []string
    name String
    protocol String
    Available values is 'HTTP' (currently work, other do not work on ed-8), 'HTTPS', 'TCP', 'UDP'
    protocolPort Double
    certificate String
    certificateChain String
    id String
    The ID of this resource.
    insertXForwarded Boolean
    privateKey String
    secretId String
    sniSecretIds List<String>
    name string
    protocol string
    Available values is 'HTTP' (currently work, other do not work on ed-8), 'HTTPS', 'TCP', 'UDP'
    protocolPort number
    certificate string
    certificateChain string
    id string
    The ID of this resource.
    insertXForwarded boolean
    privateKey string
    secretId string
    sniSecretIds string[]
    name str
    protocol str
    Available values is 'HTTP' (currently work, other do not work on ed-8), 'HTTPS', 'TCP', 'UDP'
    protocol_port float
    certificate str
    certificate_chain str
    id str
    The ID of this resource.
    insert_x_forwarded bool
    private_key str
    secret_id str
    sni_secret_ids Sequence[str]
    name String
    protocol String
    Available values is 'HTTP' (currently work, other do not work on ed-8), 'HTTPS', 'TCP', 'UDP'
    protocolPort Number
    certificate String
    certificateChain String
    id String
    The ID of this resource.
    insertXForwarded Boolean
    privateKey String
    secretId String
    sniSecretIds List<String>

    LoadbalancerMetadataReadOnly, LoadbalancerMetadataReadOnlyArgs

    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

    LoadbalancerTimeouts, LoadbalancerTimeoutsArgs

    Create string
    Delete string
    Create string
    Delete string
    create String
    delete String
    create string
    delete string
    create str
    delete str
    create String
    delete String

    Import

    import using <project_id>:<region_id>:<loadbalancer_id>:<listener_id> format, listener_id - nested listener id

    $ pulumi import gcorelabs:index/loadbalancer:Loadbalancer loadbalancer1 1:6:447d2959-8ae0-4ca0-8d47-9f050a3637d7:a336f28c-fbb0-4256-9545-e905bed9f48f
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    gcorelabs g-core/terraform-provider-gcorelabs
    License
    Notes
    This Pulumi package is based on the gcorelabs Terraform Provider.
    gcorelabs logo
    gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core