ionoscloud.Loadbalancer
Explore with Pulumi AI
Manages a Load Balancer on IonosCloud.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
import * as random from "@pulumi/random";
const exampleDatacenter = new ionoscloud.Datacenter("exampleDatacenter", {
location: "us/las",
description: "Datacenter Description",
secAuthProtection: false,
});
const exampleLan = new ionoscloud.Lan("exampleLan", {
datacenterId: exampleDatacenter.datacenterId,
"public": true,
});
const serverImagePassword = new random.index.Random_password("serverImagePassword", {
length: 16,
special: false,
});
const exampleServer = new ionoscloud.Server("exampleServer", {
datacenterId: exampleDatacenter.datacenterId,
cores: 1,
ram: 1024,
availabilityZone: "ZONE_1",
cpuFamily: "INTEL_XEON",
imageName: "Ubuntu-20.04",
imagePassword: serverImagePassword.result,
volume: {
name: "system",
size: 14,
diskType: "SSD",
},
nic: {
lan: 1,
dhcp: true,
firewallActive: true,
},
});
const exampleLoadbalancer = new ionoscloud.Loadbalancer("exampleLoadbalancer", {
datacenterId: exampleDatacenter.datacenterId,
nicIds: [exampleServer.primaryNic],
dhcp: true,
});
import pulumi
import pulumi_ionoscloud as ionoscloud
import pulumi_random as random
example_datacenter = ionoscloud.Datacenter("exampleDatacenter",
location="us/las",
description="Datacenter Description",
sec_auth_protection=False)
example_lan = ionoscloud.Lan("exampleLan",
datacenter_id=example_datacenter.datacenter_id,
public=True)
server_image_password = random.index.Random_password("serverImagePassword",
length=16,
special=False)
example_server = ionoscloud.Server("exampleServer",
datacenter_id=example_datacenter.datacenter_id,
cores=1,
ram=1024,
availability_zone="ZONE_1",
cpu_family="INTEL_XEON",
image_name="Ubuntu-20.04",
image_password=server_image_password["result"],
volume={
"name": "system",
"size": 14,
"disk_type": "SSD",
},
nic={
"lan": 1,
"dhcp": True,
"firewall_active": True,
})
example_loadbalancer = ionoscloud.Loadbalancer("exampleLoadbalancer",
datacenter_id=example_datacenter.datacenter_id,
nic_ids=[example_server.primary_nic],
dhcp=True)
package main
import (
"github.com/pulumi/pulumi-random/sdk/go/random"
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleDatacenter, err := ionoscloud.NewDatacenter(ctx, "exampleDatacenter", &ionoscloud.DatacenterArgs{
Location: pulumi.String("us/las"),
Description: pulumi.String("Datacenter Description"),
SecAuthProtection: pulumi.Bool(false),
})
if err != nil {
return err
}
_, err = ionoscloud.NewLan(ctx, "exampleLan", &ionoscloud.LanArgs{
DatacenterId: exampleDatacenter.DatacenterId,
Public: pulumi.Bool(true),
})
if err != nil {
return err
}
serverImagePassword, err := random.NewRandom_password(ctx, "serverImagePassword", &random.Random_passwordArgs{
Length: 16,
Special: false,
})
if err != nil {
return err
}
exampleServer, err := ionoscloud.NewServer(ctx, "exampleServer", &ionoscloud.ServerArgs{
DatacenterId: exampleDatacenter.DatacenterId,
Cores: pulumi.Float64(1),
Ram: pulumi.Float64(1024),
AvailabilityZone: pulumi.String("ZONE_1"),
CpuFamily: pulumi.String("INTEL_XEON"),
ImageName: pulumi.String("Ubuntu-20.04"),
ImagePassword: serverImagePassword.Result,
Volume: &ionoscloud.ServerVolumeArgs{
Name: pulumi.String("system"),
Size: pulumi.Float64(14),
DiskType: pulumi.String("SSD"),
},
Nic: &ionoscloud.ServerNicArgs{
Lan: pulumi.Float64(1),
Dhcp: pulumi.Bool(true),
FirewallActive: pulumi.Bool(true),
},
})
if err != nil {
return err
}
_, err = ionoscloud.NewLoadbalancer(ctx, "exampleLoadbalancer", &ionoscloud.LoadbalancerArgs{
DatacenterId: exampleDatacenter.DatacenterId,
NicIds: pulumi.StringArray{
exampleServer.PrimaryNic,
},
Dhcp: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
using Random = Pulumi.Random;
return await Deployment.RunAsync(() =>
{
var exampleDatacenter = new Ionoscloud.Datacenter("exampleDatacenter", new()
{
Location = "us/las",
Description = "Datacenter Description",
SecAuthProtection = false,
});
var exampleLan = new Ionoscloud.Lan("exampleLan", new()
{
DatacenterId = exampleDatacenter.DatacenterId,
Public = true,
});
var serverImagePassword = new Random.Index.Random_password("serverImagePassword", new()
{
Length = 16,
Special = false,
});
var exampleServer = new Ionoscloud.Server("exampleServer", new()
{
DatacenterId = exampleDatacenter.DatacenterId,
Cores = 1,
Ram = 1024,
AvailabilityZone = "ZONE_1",
CpuFamily = "INTEL_XEON",
ImageName = "Ubuntu-20.04",
ImagePassword = serverImagePassword.Result,
Volume = new Ionoscloud.Inputs.ServerVolumeArgs
{
Name = "system",
Size = 14,
DiskType = "SSD",
},
Nic = new Ionoscloud.Inputs.ServerNicArgs
{
Lan = 1,
Dhcp = true,
FirewallActive = true,
},
});
var exampleLoadbalancer = new Ionoscloud.Loadbalancer("exampleLoadbalancer", new()
{
DatacenterId = exampleDatacenter.DatacenterId,
NicIds = new[]
{
exampleServer.PrimaryNic,
},
Dhcp = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.Datacenter;
import com.pulumi.ionoscloud.DatacenterArgs;
import com.pulumi.ionoscloud.Lan;
import com.pulumi.ionoscloud.LanArgs;
import com.pulumi.random.random_password;
import com.pulumi.random.Random_passwordArgs;
import com.pulumi.ionoscloud.Server;
import com.pulumi.ionoscloud.ServerArgs;
import com.pulumi.ionoscloud.inputs.ServerVolumeArgs;
import com.pulumi.ionoscloud.inputs.ServerNicArgs;
import com.pulumi.ionoscloud.Loadbalancer;
import com.pulumi.ionoscloud.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 exampleDatacenter = new Datacenter("exampleDatacenter", DatacenterArgs.builder()
.location("us/las")
.description("Datacenter Description")
.secAuthProtection(false)
.build());
var exampleLan = new Lan("exampleLan", LanArgs.builder()
.datacenterId(exampleDatacenter.datacenterId())
.public_(true)
.build());
var serverImagePassword = new Random_password("serverImagePassword", Random_passwordArgs.builder()
.length(16)
.special(false)
.build());
var exampleServer = new Server("exampleServer", ServerArgs.builder()
.datacenterId(exampleDatacenter.datacenterId())
.cores(1)
.ram(1024)
.availabilityZone("ZONE_1")
.cpuFamily("INTEL_XEON")
.imageName("Ubuntu-20.04")
.imagePassword(serverImagePassword.result())
.volume(ServerVolumeArgs.builder()
.name("system")
.size(14)
.diskType("SSD")
.build())
.nic(ServerNicArgs.builder()
.lan("1")
.dhcp(true)
.firewallActive(true)
.build())
.build());
var exampleLoadbalancer = new Loadbalancer("exampleLoadbalancer", LoadbalancerArgs.builder()
.datacenterId(exampleDatacenter.datacenterId())
.nicIds(exampleServer.primaryNic())
.dhcp(true)
.build());
}
}
resources:
exampleDatacenter:
type: ionoscloud:Datacenter
properties:
location: us/las
description: Datacenter Description
secAuthProtection: false
exampleLan:
type: ionoscloud:Lan
properties:
datacenterId: ${exampleDatacenter.datacenterId}
public: true
exampleServer:
type: ionoscloud:Server
properties:
datacenterId: ${exampleDatacenter.datacenterId}
cores: 1
ram: 1024
availabilityZone: ZONE_1
cpuFamily: INTEL_XEON
imageName: Ubuntu-20.04
imagePassword: ${serverImagePassword.result}
volume:
name: system
size: 14
diskType: SSD
nic:
lan: '1'
dhcp: true
firewallActive: true
exampleLoadbalancer:
type: ionoscloud:Loadbalancer
properties:
datacenterId: ${exampleDatacenter.datacenterId}
nicIds:
- ${exampleServer.primaryNic}
dhcp: true
serverImagePassword:
type: random:random_password
properties:
length: 16
special: false
A note on nics
When declaring NIC resources to be used with the load balancer, please make sure you use the “lifecycle meta-argument” to make sure changes to the lan attribute of the nic are ignored.
Please see the Nic resource’s documentation for an example on how to do that.
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,
datacenter_id: Optional[str] = None,
nic_ids: Optional[Sequence[str]] = None,
dhcp: Optional[bool] = None,
ip: Optional[str] = None,
loadbalancer_id: Optional[str] = None,
name: Optional[str] = None,
timeouts: Optional[LoadbalancerTimeoutsArgs] = 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: ionoscloud: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 Ionoscloud.Loadbalancer("loadbalancerResource", new()
{
DatacenterId = "string",
NicIds = new[]
{
"string",
},
Dhcp = false,
Ip = "string",
LoadbalancerId = "string",
Name = "string",
Timeouts = new Ionoscloud.Inputs.LoadbalancerTimeoutsArgs
{
Create = "string",
Default = "string",
Delete = "string",
Update = "string",
},
});
example, err := ionoscloud.NewLoadbalancer(ctx, "loadbalancerResource", &ionoscloud.LoadbalancerArgs{
DatacenterId: pulumi.String("string"),
NicIds: pulumi.StringArray{
pulumi.String("string"),
},
Dhcp: pulumi.Bool(false),
Ip: pulumi.String("string"),
LoadbalancerId: pulumi.String("string"),
Name: pulumi.String("string"),
Timeouts: &ionoscloud.LoadbalancerTimeoutsArgs{
Create: pulumi.String("string"),
Default: pulumi.String("string"),
Delete: pulumi.String("string"),
Update: pulumi.String("string"),
},
})
var loadbalancerResource = new Loadbalancer("loadbalancerResource", LoadbalancerArgs.builder()
.datacenterId("string")
.nicIds("string")
.dhcp(false)
.ip("string")
.loadbalancerId("string")
.name("string")
.timeouts(LoadbalancerTimeoutsArgs.builder()
.create("string")
.default_("string")
.delete("string")
.update("string")
.build())
.build());
loadbalancer_resource = ionoscloud.Loadbalancer("loadbalancerResource",
datacenter_id="string",
nic_ids=["string"],
dhcp=False,
ip="string",
loadbalancer_id="string",
name="string",
timeouts={
"create": "string",
"default": "string",
"delete": "string",
"update": "string",
})
const loadbalancerResource = new ionoscloud.Loadbalancer("loadbalancerResource", {
datacenterId: "string",
nicIds: ["string"],
dhcp: false,
ip: "string",
loadbalancerId: "string",
name: "string",
timeouts: {
create: "string",
"default": "string",
"delete": "string",
update: "string",
},
});
type: ionoscloud:Loadbalancer
properties:
datacenterId: string
dhcp: false
ip: string
loadbalancerId: string
name: string
nicIds:
- string
timeouts:
create: string
default: string
delete: string
update: 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:
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Nic
Ids List<string> - [list] A list of NIC IDs that are part of the load balancer.
- Dhcp bool
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- Ip string
- [string] IPv4 address of the load balancer.
- Loadbalancer
Id string - Name string
- [string] The name of the load balancer.
- Timeouts
Loadbalancer
Timeouts
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Nic
Ids []string - [list] A list of NIC IDs that are part of the load balancer.
- Dhcp bool
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- Ip string
- [string] IPv4 address of the load balancer.
- Loadbalancer
Id string - Name string
- [string] The name of the load balancer.
- Timeouts
Loadbalancer
Timeouts Args
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- nic
Ids List<String> - [list] A list of NIC IDs that are part of the load balancer.
- dhcp Boolean
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip String
- [string] IPv4 address of the load balancer.
- loadbalancer
Id String - name String
- [string] The name of the load balancer.
- timeouts
Loadbalancer
Timeouts
- datacenter
Id string - [string] The ID of a Virtual Data Center.
- nic
Ids string[] - [list] A list of NIC IDs that are part of the load balancer.
- dhcp boolean
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip string
- [string] IPv4 address of the load balancer.
- loadbalancer
Id string - name string
- [string] The name of the load balancer.
- timeouts
Loadbalancer
Timeouts
- datacenter_
id str - [string] The ID of a Virtual Data Center.
- nic_
ids Sequence[str] - [list] A list of NIC IDs that are part of the load balancer.
- dhcp bool
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip str
- [string] IPv4 address of the load balancer.
- loadbalancer_
id str - name str
- [string] The name of the load balancer.
- timeouts
Loadbalancer
Timeouts Args
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- nic
Ids List<String> - [list] A list of NIC IDs that are part of the load balancer.
- dhcp Boolean
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip String
- [string] IPv4 address of the load balancer.
- loadbalancer
Id String - name String
- [string] The name of the load balancer.
- timeouts Property Map
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.
- 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 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,
datacenter_id: Optional[str] = None,
dhcp: Optional[bool] = None,
ip: Optional[str] = None,
loadbalancer_id: Optional[str] = None,
name: Optional[str] = None,
nic_ids: Optional[Sequence[str]] = None,
timeouts: Optional[LoadbalancerTimeoutsArgs] = 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: ionoscloud: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.
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Dhcp bool
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- Ip string
- [string] IPv4 address of the load balancer.
- Loadbalancer
Id string - Name string
- [string] The name of the load balancer.
- Nic
Ids List<string> - [list] A list of NIC IDs that are part of the load balancer.
- Timeouts
Loadbalancer
Timeouts
- Datacenter
Id string - [string] The ID of a Virtual Data Center.
- Dhcp bool
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- Ip string
- [string] IPv4 address of the load balancer.
- Loadbalancer
Id string - Name string
- [string] The name of the load balancer.
- Nic
Ids []string - [list] A list of NIC IDs that are part of the load balancer.
- Timeouts
Loadbalancer
Timeouts Args
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- dhcp Boolean
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip String
- [string] IPv4 address of the load balancer.
- loadbalancer
Id String - name String
- [string] The name of the load balancer.
- nic
Ids List<String> - [list] A list of NIC IDs that are part of the load balancer.
- timeouts
Loadbalancer
Timeouts
- datacenter
Id string - [string] The ID of a Virtual Data Center.
- dhcp boolean
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip string
- [string] IPv4 address of the load balancer.
- loadbalancer
Id string - name string
- [string] The name of the load balancer.
- nic
Ids string[] - [list] A list of NIC IDs that are part of the load balancer.
- timeouts
Loadbalancer
Timeouts
- datacenter_
id str - [string] The ID of a Virtual Data Center.
- dhcp bool
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip str
- [string] IPv4 address of the load balancer.
- loadbalancer_
id str - name str
- [string] The name of the load balancer.
- nic_
ids Sequence[str] - [list] A list of NIC IDs that are part of the load balancer.
- timeouts
Loadbalancer
Timeouts Args
- datacenter
Id String - [string] The ID of a Virtual Data Center.
- dhcp Boolean
- [Boolean] Indicates if the load balancer will reserve an IP using DHCP.
- ip String
- [string] IPv4 address of the load balancer.
- loadbalancer
Id String - name String
- [string] The name of the load balancer.
- nic
Ids List<String> - [list] A list of NIC IDs that are part of the load balancer.
- timeouts Property Map
Supporting Types
LoadbalancerTimeouts, LoadbalancerTimeoutsArgs
Import
Resource Load Balancer can be imported using the resource id
, e.g.
$ pulumi import ionoscloud:index/loadbalancer:Loadbalancer myloadbalancer datacenter uuid/loadbalancer uuid
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ionoscloud ionos-cloud/terraform-provider-ionoscloud
- License
- Notes
- This Pulumi package is based on the
ionoscloud
Terraform Provider.