1. Packages
  2. Ibm Provider
  3. API Docs
  4. LbService
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.LbService

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Create, update, and delete a local load balancer service. For more information, about local load balancer service, see load balancer basics.

    Note

    For more information, see the IBM Cloud Classic Infrastructure (SoftLayer) API docs.

    Example Usage

    In the following example, you can create a local load balancer service:

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const testLbLocalService = new ibm.LbService("testLbLocalService", {
        port: 80,
        enabled: true,
        serviceGroupId: ibm_lb_service_group.test_service_group.service_group_id,
        weight: 1,
        healthCheckType: "DNS",
        ipAddressId: ibm_compute_vm_instance.test_server.ip_address_id,
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    test_lb_local_service = ibm.LbService("testLbLocalService",
        port=80,
        enabled=True,
        service_group_id=ibm_lb_service_group["test_service_group"]["service_group_id"],
        weight=1,
        health_check_type="DNS",
        ip_address_id=ibm_compute_vm_instance["test_server"]["ip_address_id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.NewLbService(ctx, "testLbLocalService", &ibm.LbServiceArgs{
    			Port:            pulumi.Float64(80),
    			Enabled:         pulumi.Bool(true),
    			ServiceGroupId:  pulumi.Any(ibm_lb_service_group.Test_service_group.Service_group_id),
    			Weight:          pulumi.Float64(1),
    			HealthCheckType: pulumi.String("DNS"),
    			IpAddressId:     pulumi.Any(ibm_compute_vm_instance.Test_server.Ip_address_id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var testLbLocalService = new Ibm.LbService("testLbLocalService", new()
        {
            Port = 80,
            Enabled = true,
            ServiceGroupId = ibm_lb_service_group.Test_service_group.Service_group_id,
            Weight = 1,
            HealthCheckType = "DNS",
            IpAddressId = ibm_compute_vm_instance.Test_server.Ip_address_id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.LbService;
    import com.pulumi.ibm.LbServiceArgs;
    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 testLbLocalService = new LbService("testLbLocalService", LbServiceArgs.builder()
                .port(80)
                .enabled(true)
                .serviceGroupId(ibm_lb_service_group.test_service_group().service_group_id())
                .weight(1)
                .healthCheckType("DNS")
                .ipAddressId(ibm_compute_vm_instance.test_server().ip_address_id())
                .build());
    
        }
    }
    
    resources:
      testLbLocalService:
        type: ibm:LbService
        properties:
          port: 80
          enabled: true
          serviceGroupId: ${ibm_lb_service_group.test_service_group.service_group_id}
          weight: 1
          healthCheckType: DNS
          ipAddressId: ${ibm_compute_vm_instance.test_server.ip_address_id}
    

    Argument reference

    Review the argument references that you can specify for your resource.

    • ip_address_id - (Required, Forces new resource,Integer) The ID of the virtual server.Yes.
    • enabled - (Required, Integer) Specifies whether you want to enable the load balancer service. The default value is false.
    • health_check_type - (Required, String)The health check type for the load balancer service.No.
    • port - (Required, Integer) The port for the local load balancer service.
    • service_group_id - (Required, Forces new resource,Integer) The ID of the local load balancer service group.
    • tags- (Optional, Array of Strings) Tags associated with the local load balancer service instance. Note Tags are managed locally and not stored on the IBM Cloud Service Endpoint at this moment.
    • weight - (Required, Integer) The weight for the load balancer service.

    Create LbService Resource

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

    Constructor syntax

    new LbService(name: string, args: LbServiceArgs, opts?: CustomResourceOptions);
    @overload
    def LbService(resource_name: str,
                  args: LbServiceArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def LbService(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  enabled: Optional[bool] = None,
                  health_check_type: Optional[str] = None,
                  ip_address_id: Optional[float] = None,
                  port: Optional[float] = None,
                  service_group_id: Optional[float] = None,
                  weight: Optional[float] = None,
                  lb_service_id: Optional[str] = None,
                  tags: Optional[Sequence[str]] = None)
    func NewLbService(ctx *Context, name string, args LbServiceArgs, opts ...ResourceOption) (*LbService, error)
    public LbService(string name, LbServiceArgs args, CustomResourceOptions? opts = null)
    public LbService(String name, LbServiceArgs args)
    public LbService(String name, LbServiceArgs args, CustomResourceOptions options)
    
    type: ibm:LbService
    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 LbServiceArgs
    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 LbServiceArgs
    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 LbServiceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LbServiceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LbServiceArgs
    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 lbServiceResource = new Ibm.LbService("lbServiceResource", new()
    {
        Enabled = false,
        HealthCheckType = "string",
        IpAddressId = 0,
        Port = 0,
        ServiceGroupId = 0,
        Weight = 0,
        LbServiceId = "string",
        Tags = new[]
        {
            "string",
        },
    });
    
    example, err := ibm.NewLbService(ctx, "lbServiceResource", &ibm.LbServiceArgs{
    	Enabled:         pulumi.Bool(false),
    	HealthCheckType: pulumi.String("string"),
    	IpAddressId:     pulumi.Float64(0),
    	Port:            pulumi.Float64(0),
    	ServiceGroupId:  pulumi.Float64(0),
    	Weight:          pulumi.Float64(0),
    	LbServiceId:     pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    })
    
    var lbServiceResource = new LbService("lbServiceResource", LbServiceArgs.builder()
        .enabled(false)
        .healthCheckType("string")
        .ipAddressId(0)
        .port(0)
        .serviceGroupId(0)
        .weight(0)
        .lbServiceId("string")
        .tags("string")
        .build());
    
    lb_service_resource = ibm.LbService("lbServiceResource",
        enabled=False,
        health_check_type="string",
        ip_address_id=0,
        port=0,
        service_group_id=0,
        weight=0,
        lb_service_id="string",
        tags=["string"])
    
    const lbServiceResource = new ibm.LbService("lbServiceResource", {
        enabled: false,
        healthCheckType: "string",
        ipAddressId: 0,
        port: 0,
        serviceGroupId: 0,
        weight: 0,
        lbServiceId: "string",
        tags: ["string"],
    });
    
    type: ibm:LbService
    properties:
        enabled: false
        healthCheckType: string
        ipAddressId: 0
        lbServiceId: string
        port: 0
        serviceGroupId: 0
        tags:
            - string
        weight: 0
    

    LbService 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 LbService resource accepts the following input properties:

    Enabled bool
    Boolean value true, if enabled else false
    HealthCheckType string
    health check type
    IpAddressId double
    IP Address ID
    Port double
    Port number
    ServiceGroupId double
    service group ID
    Weight double
    Weight value
    LbServiceId string
    Tags List<string>
    Tags for the resource
    Enabled bool
    Boolean value true, if enabled else false
    HealthCheckType string
    health check type
    IpAddressId float64
    IP Address ID
    Port float64
    Port number
    ServiceGroupId float64
    service group ID
    Weight float64
    Weight value
    LbServiceId string
    Tags []string
    Tags for the resource
    enabled Boolean
    Boolean value true, if enabled else false
    healthCheckType String
    health check type
    ipAddressId Double
    IP Address ID
    port Double
    Port number
    serviceGroupId Double
    service group ID
    weight Double
    Weight value
    lbServiceId String
    tags List<String>
    Tags for the resource
    enabled boolean
    Boolean value true, if enabled else false
    healthCheckType string
    health check type
    ipAddressId number
    IP Address ID
    port number
    Port number
    serviceGroupId number
    service group ID
    weight number
    Weight value
    lbServiceId string
    tags string[]
    Tags for the resource
    enabled bool
    Boolean value true, if enabled else false
    health_check_type str
    health check type
    ip_address_id float
    IP Address ID
    port float
    Port number
    service_group_id float
    service group ID
    weight float
    Weight value
    lb_service_id str
    tags Sequence[str]
    Tags for the resource
    enabled Boolean
    Boolean value true, if enabled else false
    healthCheckType String
    health check type
    ipAddressId Number
    IP Address ID
    port Number
    Port number
    serviceGroupId Number
    service group ID
    weight Number
    Weight value
    lbServiceId String
    tags List<String>
    Tags for the resource

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing LbService Resource

    Get an existing LbService 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?: LbServiceState, opts?: CustomResourceOptions): LbService
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enabled: Optional[bool] = None,
            health_check_type: Optional[str] = None,
            ip_address_id: Optional[float] = None,
            lb_service_id: Optional[str] = None,
            port: Optional[float] = None,
            service_group_id: Optional[float] = None,
            tags: Optional[Sequence[str]] = None,
            weight: Optional[float] = None) -> LbService
    func GetLbService(ctx *Context, name string, id IDInput, state *LbServiceState, opts ...ResourceOption) (*LbService, error)
    public static LbService Get(string name, Input<string> id, LbServiceState? state, CustomResourceOptions? opts = null)
    public static LbService get(String name, Output<String> id, LbServiceState state, CustomResourceOptions options)
    resources:  _:    type: ibm:LbService    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:
    Enabled bool
    Boolean value true, if enabled else false
    HealthCheckType string
    health check type
    IpAddressId double
    IP Address ID
    LbServiceId string
    Port double
    Port number
    ServiceGroupId double
    service group ID
    Tags List<string>
    Tags for the resource
    Weight double
    Weight value
    Enabled bool
    Boolean value true, if enabled else false
    HealthCheckType string
    health check type
    IpAddressId float64
    IP Address ID
    LbServiceId string
    Port float64
    Port number
    ServiceGroupId float64
    service group ID
    Tags []string
    Tags for the resource
    Weight float64
    Weight value
    enabled Boolean
    Boolean value true, if enabled else false
    healthCheckType String
    health check type
    ipAddressId Double
    IP Address ID
    lbServiceId String
    port Double
    Port number
    serviceGroupId Double
    service group ID
    tags List<String>
    Tags for the resource
    weight Double
    Weight value
    enabled boolean
    Boolean value true, if enabled else false
    healthCheckType string
    health check type
    ipAddressId number
    IP Address ID
    lbServiceId string
    port number
    Port number
    serviceGroupId number
    service group ID
    tags string[]
    Tags for the resource
    weight number
    Weight value
    enabled bool
    Boolean value true, if enabled else false
    health_check_type str
    health check type
    ip_address_id float
    IP Address ID
    lb_service_id str
    port float
    Port number
    service_group_id float
    service group ID
    tags Sequence[str]
    Tags for the resource
    weight float
    Weight value
    enabled Boolean
    Boolean value true, if enabled else false
    healthCheckType String
    health check type
    ipAddressId Number
    IP Address ID
    lbServiceId String
    port Number
    Port number
    serviceGroupId Number
    service group ID
    tags List<String>
    Tags for the resource
    weight Number
    Weight value

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud