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

gcore.Loadbalancer

Explore with Pulumi AI

gcore logo
gcore 0.22.0 published on Wednesday, Apr 30, 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.Loadbalancer("lb", {
        flavor: "lb1-1-2",
        listener: {
            name: "test",
            protocol: "HTTP",
            protocolPort: 80,
        },
        projectId: 1,
        regionId: 1,
    });
    
    import pulumi
    import pulumi_gcore as gcore
    
    lb = gcore.Loadbalancer("lb",
        flavor="lb1-1-2",
        listener={
            "name": "test",
            "protocol": "HTTP",
            "protocol_port": 80,
        },
        project_id=1,
        region_id=1)
    
    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 {
    		_, err := gcore.NewLoadbalancer(ctx, "lb", &gcore.LoadbalancerArgs{
    			Flavor: pulumi.String("lb1-1-2"),
    			Listener: &gcore.LoadbalancerListenerArgs{
    				Name:         pulumi.String("test"),
    				Protocol:     pulumi.String("HTTP"),
    				ProtocolPort: pulumi.Float64(80),
    			},
    			ProjectId: pulumi.Float64(1),
    			RegionId:  pulumi.Float64(1),
    		})
    		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.Loadbalancer("lb", new()
        {
            Flavor = "lb1-1-2",
            Listener = new Gcore.Inputs.LoadbalancerListenerArgs
            {
                Name = "test",
                Protocol = "HTTP",
                ProtocolPort = 80,
            },
            ProjectId = 1,
            RegionId = 1,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcore.Loadbalancer;
    import com.pulumi.gcore.LoadbalancerArgs;
    import com.pulumi.gcore.inputs.LoadbalancerListenerArgs;
    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 Loadbalancer("lb", LoadbalancerArgs.builder()
                .flavor("lb1-1-2")
                .listener(LoadbalancerListenerArgs.builder()
                    .name("test")
                    .protocol("HTTP")
                    .protocolPort(80)
                    .build())
                .projectId(1)
                .regionId(1)
                .build());
    
        }
    }
    
    resources:
      lb:
        type: gcore:Loadbalancer
        properties:
          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
          projectId: 1
          regionId: 1
    

    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,
                     flavor: Optional[str] = None,
                     loadbalancer_id: Optional[str] = None,
                     metadata_map: 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,
                     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: gcore: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 Gcore.Loadbalancer("loadbalancerResource", new()
    {
        Listener = new Gcore.Inputs.LoadbalancerListenerArgs
        {
            Name = "string",
            Protocol = "string",
            ProtocolPort = 0,
            Certificate = "string",
            CertificateChain = "string",
            Id = "string",
            InsertXForwarded = false,
            PrivateKey = "string",
            SecretId = "string",
            SniSecretIds = new[]
            {
                "string",
            },
        },
        Flavor = "string",
        LoadbalancerId = "string",
        MetadataMap = 
        {
            { "string", "string" },
        },
        Name = "string",
        ProjectId = 0,
        ProjectName = "string",
        RegionId = 0,
        RegionName = "string",
        Timeouts = new Gcore.Inputs.LoadbalancerTimeoutsArgs
        {
            Create = "string",
            Delete = "string",
            Update = "string",
        },
        VipNetworkId = "string",
        VipSubnetId = "string",
    });
    
    example, err := gcore.NewLoadbalancer(ctx, "loadbalancerResource", &gcore.LoadbalancerArgs{
    	Listener: &gcore.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"),
    		},
    	},
    	Flavor:         pulumi.String("string"),
    	LoadbalancerId: pulumi.String("string"),
    	MetadataMap: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Name:        pulumi.String("string"),
    	ProjectId:   pulumi.Float64(0),
    	ProjectName: pulumi.String("string"),
    	RegionId:    pulumi.Float64(0),
    	RegionName:  pulumi.String("string"),
    	Timeouts: &gcore.LoadbalancerTimeoutsArgs{
    		Create: pulumi.String("string"),
    		Delete: pulumi.String("string"),
    		Update: 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())
        .flavor("string")
        .loadbalancerId("string")
        .metadataMap(Map.of("string", "string"))
        .name("string")
        .projectId(0)
        .projectName("string")
        .regionId(0)
        .regionName("string")
        .timeouts(LoadbalancerTimeoutsArgs.builder()
            .create("string")
            .delete("string")
            .update("string")
            .build())
        .vipNetworkId("string")
        .vipSubnetId("string")
        .build());
    
    loadbalancer_resource = gcore.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"],
        },
        flavor="string",
        loadbalancer_id="string",
        metadata_map={
            "string": "string",
        },
        name="string",
        project_id=0,
        project_name="string",
        region_id=0,
        region_name="string",
        timeouts={
            "create": "string",
            "delete": "string",
            "update": "string",
        },
        vip_network_id="string",
        vip_subnet_id="string")
    
    const loadbalancerResource = new gcore.Loadbalancer("loadbalancerResource", {
        listener: {
            name: "string",
            protocol: "string",
            protocolPort: 0,
            certificate: "string",
            certificateChain: "string",
            id: "string",
            insertXForwarded: false,
            privateKey: "string",
            secretId: "string",
            sniSecretIds: ["string"],
        },
        flavor: "string",
        loadbalancerId: "string",
        metadataMap: {
            string: "string",
        },
        name: "string",
        projectId: 0,
        projectName: "string",
        regionId: 0,
        regionName: "string",
        timeouts: {
            create: "string",
            "delete": "string",
            update: "string",
        },
        vipNetworkId: "string",
        vipSubnetId: "string",
    });
    
    type: gcore:Loadbalancer
    properties:
        flavor: 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
            update: 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
    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
    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
    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
    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
    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.
    LastUpdated string
    MetadataReadOnlies List<LoadbalancerMetadataReadOnly>
    VipAddress string
    Load balancer IP address
    Id string
    The provider-assigned unique ID for this managed resource.
    LastUpdated string
    MetadataReadOnlies []LoadbalancerMetadataReadOnly
    VipAddress string
    Load balancer IP address
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdated String
    metadataReadOnlies List<LoadbalancerMetadataReadOnly>
    vipAddress String
    Load balancer IP address
    id string
    The provider-assigned unique ID for this managed resource.
    lastUpdated string
    metadataReadOnlies LoadbalancerMetadataReadOnly[]
    vipAddress string
    Load balancer IP address
    id str
    The provider-assigned unique ID for this managed resource.
    last_updated str
    metadata_read_onlies Sequence[LoadbalancerMetadataReadOnly]
    vip_address str
    Load balancer IP address
    id String
    The provider-assigned unique ID for this managed resource.
    lastUpdated String
    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: gcore: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 are 'HTTP', 'HTTPS', 'TCP', 'UDP'
    ProtocolPort double
    Certificate string
    CertificateChain string
    Id string
    InsertXForwarded bool
    PrivateKey string
    SecretId string
    SniSecretIds List<string>
    Name string
    Protocol string
    Available values are 'HTTP', 'HTTPS', 'TCP', 'UDP'
    ProtocolPort float64
    Certificate string
    CertificateChain string
    Id string
    InsertXForwarded bool
    PrivateKey string
    SecretId string
    SniSecretIds []string
    name String
    protocol String
    Available values are 'HTTP', 'HTTPS', 'TCP', 'UDP'
    protocolPort Double
    certificate String
    certificateChain String
    id String
    insertXForwarded Boolean
    privateKey String
    secretId String
    sniSecretIds List<String>
    name string
    protocol string
    Available values are 'HTTP', 'HTTPS', 'TCP', 'UDP'
    protocolPort number
    certificate string
    certificateChain string
    id string
    insertXForwarded boolean
    privateKey string
    secretId string
    sniSecretIds string[]
    name str
    protocol str
    Available values are 'HTTP', 'HTTPS', 'TCP', 'UDP'
    protocol_port float
    certificate str
    certificate_chain str
    id str
    insert_x_forwarded bool
    private_key str
    secret_id str
    sni_secret_ids Sequence[str]
    name String
    protocol String
    Available values are 'HTTP', 'HTTPS', 'TCP', 'UDP'
    protocolPort Number
    certificate String
    certificateChain String
    id String
    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
    Update string
    Create string
    Delete string
    Update string
    create String
    delete String
    update String
    create string
    delete string
    update string
    create str
    delete str
    update str
    create String
    delete String
    update String

    Import

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

    $ pulumi import gcore: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
    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