UNPKG

@pulumi/digitalocean

Version:

A Pulumi package for creating and managing DigitalOcean cloud resources.

437 lines (436 loc) • 19.2 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "./types/input"; import * as outputs from "./types/output"; import * as enums from "./types/enums"; /** * Provides a DigitalOcean Load Balancer resource. This can be used to create, * modify, and delete Load Balancers. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as digitalocean from "@pulumi/digitalocean"; * * const web = new digitalocean.Droplet("web", { * name: "web-1", * size: digitalocean.DropletSlug.DropletS1VCPU1GB, * image: "ubuntu-18-04-x64", * region: digitalocean.Region.NYC3, * }); * const _public = new digitalocean.LoadBalancer("public", { * name: "loadbalancer-1", * region: digitalocean.Region.NYC3, * forwardingRules: [{ * entryPort: 80, * entryProtocol: "http", * targetPort: 80, * targetProtocol: "http", * }], * healthcheck: { * port: 22, * protocol: "tcp", * }, * dropletIds: [web.id], * }); * ``` * * When managing certificates attached to the load balancer, make sure to add the `createBeforeDestroy` * lifecycle property in order to ensure the certificate is correctly updated when changed. The order of * operations will then be: `Create new certificate` > `Update loadbalancer with new certificate` -> * `Delete old certificate`. When doing so, you must also change the name of the certificate, * as there cannot be multiple certificates with the same name in an account. * * ## Import * * Load Balancers can be imported using the `id`, e.g. * * ```sh * $ pulumi import digitalocean:index/loadBalancer:LoadBalancer myloadbalancer 4de7ac8b-495b-4884-9a69-1050c6793cd6 * ``` */ export declare class LoadBalancer extends pulumi.CustomResource { /** * Get an existing LoadBalancer resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: LoadBalancerState, opts?: pulumi.CustomResourceOptions): LoadBalancer; /** * Returns true if the given object is an instance of LoadBalancer. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is LoadBalancer; /** * **Deprecated** This field has been deprecated. You can no longer specify an algorithm for load balancers. * or `leastConnections`. The default value is `roundRobin`. * * @deprecated This field has been deprecated. You can no longer specify an algorithm for load balancers. */ readonly algorithm: pulumi.Output<string | undefined>; /** * A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer. Default value is `false`. */ readonly disableLetsEncryptDnsRecords: pulumi.Output<boolean | undefined>; /** * A list of `domains` required to ingress traffic to a Global Load Balancer. The `domains` block is documented below. */ readonly domains: pulumi.Output<outputs.LoadBalancerDomain[]>; /** * A list of the IDs of each droplet to be attached to the Load Balancer. */ readonly dropletIds: pulumi.Output<number[]>; /** * The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer. */ readonly dropletTag: pulumi.Output<string | undefined>; /** * A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. Default value is `false`. */ readonly enableBackendKeepalive: pulumi.Output<boolean | undefined>; /** * A boolean value indicating whether PROXY * Protocol should be used to pass information from connecting client requests to * the backend service. Default value is `false`. */ readonly enableProxyProtocol: pulumi.Output<boolean | undefined>; /** * A block containing rules for allowing/denying traffic to the Load Balancer. The `firewall` block is documented below. Only 1 firewall is allowed. */ readonly firewall: pulumi.Output<outputs.LoadBalancerFirewall>; /** * A list of `forwardingRule` to be assigned to the * Load Balancer. The `forwardingRule` block is documented below. */ readonly forwardingRules: pulumi.Output<outputs.LoadBalancerForwardingRule[] | undefined>; /** * A block containing `glbSettings` required to define target rules for a Global Load Balancer. The `glbSettings` block is documented below. */ readonly glbSettings: pulumi.Output<outputs.LoadBalancerGlbSettings>; /** * A `healthcheck` block to be assigned to the * Load Balancer. The `healthcheck` block is documented below. Only 1 healthcheck is allowed. */ readonly healthcheck: pulumi.Output<outputs.LoadBalancerHealthcheck>; /** * Specifies the idle timeout for HTTPS connections on the load balancer in seconds. */ readonly httpIdleTimeoutSeconds: pulumi.Output<number>; /** * The ip of the Load Balancer */ readonly ip: pulumi.Output<string>; readonly ipv6: pulumi.Output<string>; /** * The uniform resource name for the Load Balancer */ readonly loadBalancerUrn: pulumi.Output<string>; /** * The Load Balancer name */ readonly name: pulumi.Output<string>; /** * The type of network the Load Balancer is accessible from. It must be either of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. */ readonly network: pulumi.Output<string | undefined>; /** * The network stack determines the allocation of ipv4/ipv6 addresses to the load balancer. It must be either of `IPV4` or `DUALSTACK`. Defaults to `IPV4`. */ readonly networkStack: pulumi.Output<string | undefined>; /** * The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. */ readonly projectId: pulumi.Output<string>; /** * A boolean value indicating whether * HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. * Default value is `false`. */ readonly redirectHttpToHttps: pulumi.Output<boolean | undefined>; /** * The region to start in */ readonly region: pulumi.Output<string | undefined>; /** * The size of the Load Balancer. It must be either `lb-small`, `lb-medium`, or `lb-large`. Defaults to `lb-small`. Only one of `size` or `sizeUnit` may be provided. */ readonly size: pulumi.Output<string | undefined>; /** * The size of the Load Balancer. It must be in the range (1, 200). Defaults to `1`. Only one of `size` or `sizeUnit` may be provided. */ readonly sizeUnit: pulumi.Output<number>; readonly status: pulumi.Output<string>; /** * A `stickySessions` block to be assigned to the * Load Balancer. The `stickySessions` block is documented below. Only 1 stickySessions block is allowed. */ readonly stickySessions: pulumi.Output<outputs.LoadBalancerStickySessions>; /** * A list of Load Balancer IDs to be attached behind a Global Load Balancer. */ readonly targetLoadBalancerIds: pulumi.Output<string[]>; /** * The tls cipher policy controls the cipher suites to be used by the load balancer. It must be either of `DEFAULT` or `STRONG`. Defaults to `DEFAULT`. */ readonly tlsCipherPolicy: pulumi.Output<string | undefined>; /** * The type of the Load Balancer. It must be either of `REGIONAL`, `REGIONAL_NETWORK`, or `GLOBAL`. Defaults to `REGIONAL`. */ readonly type: pulumi.Output<string>; /** * The ID of the VPC where the load balancer will be located. */ readonly vpcUuid: pulumi.Output<string>; /** * Create a LoadBalancer resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: LoadBalancerArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering LoadBalancer resources. */ export interface LoadBalancerState { /** * **Deprecated** This field has been deprecated. You can no longer specify an algorithm for load balancers. * or `leastConnections`. The default value is `roundRobin`. * * @deprecated This field has been deprecated. You can no longer specify an algorithm for load balancers. */ algorithm?: pulumi.Input<string | enums.Algorithm>; /** * A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer. Default value is `false`. */ disableLetsEncryptDnsRecords?: pulumi.Input<boolean>; /** * A list of `domains` required to ingress traffic to a Global Load Balancer. The `domains` block is documented below. */ domains?: pulumi.Input<pulumi.Input<inputs.LoadBalancerDomain>[]>; /** * A list of the IDs of each droplet to be attached to the Load Balancer. */ dropletIds?: pulumi.Input<pulumi.Input<number>[]>; /** * The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer. */ dropletTag?: pulumi.Input<string>; /** * A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. Default value is `false`. */ enableBackendKeepalive?: pulumi.Input<boolean>; /** * A boolean value indicating whether PROXY * Protocol should be used to pass information from connecting client requests to * the backend service. Default value is `false`. */ enableProxyProtocol?: pulumi.Input<boolean>; /** * A block containing rules for allowing/denying traffic to the Load Balancer. The `firewall` block is documented below. Only 1 firewall is allowed. */ firewall?: pulumi.Input<inputs.LoadBalancerFirewall>; /** * A list of `forwardingRule` to be assigned to the * Load Balancer. The `forwardingRule` block is documented below. */ forwardingRules?: pulumi.Input<pulumi.Input<inputs.LoadBalancerForwardingRule>[]>; /** * A block containing `glbSettings` required to define target rules for a Global Load Balancer. The `glbSettings` block is documented below. */ glbSettings?: pulumi.Input<inputs.LoadBalancerGlbSettings>; /** * A `healthcheck` block to be assigned to the * Load Balancer. The `healthcheck` block is documented below. Only 1 healthcheck is allowed. */ healthcheck?: pulumi.Input<inputs.LoadBalancerHealthcheck>; /** * Specifies the idle timeout for HTTPS connections on the load balancer in seconds. */ httpIdleTimeoutSeconds?: pulumi.Input<number>; /** * The ip of the Load Balancer */ ip?: pulumi.Input<string>; ipv6?: pulumi.Input<string>; /** * The uniform resource name for the Load Balancer */ loadBalancerUrn?: pulumi.Input<string>; /** * The Load Balancer name */ name?: pulumi.Input<string>; /** * The type of network the Load Balancer is accessible from. It must be either of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. */ network?: pulumi.Input<string>; /** * The network stack determines the allocation of ipv4/ipv6 addresses to the load balancer. It must be either of `IPV4` or `DUALSTACK`. Defaults to `IPV4`. */ networkStack?: pulumi.Input<string>; /** * The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. */ projectId?: pulumi.Input<string>; /** * A boolean value indicating whether * HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. * Default value is `false`. */ redirectHttpToHttps?: pulumi.Input<boolean>; /** * The region to start in */ region?: pulumi.Input<string | enums.Region>; /** * The size of the Load Balancer. It must be either `lb-small`, `lb-medium`, or `lb-large`. Defaults to `lb-small`. Only one of `size` or `sizeUnit` may be provided. */ size?: pulumi.Input<string>; /** * The size of the Load Balancer. It must be in the range (1, 200). Defaults to `1`. Only one of `size` or `sizeUnit` may be provided. */ sizeUnit?: pulumi.Input<number>; status?: pulumi.Input<string>; /** * A `stickySessions` block to be assigned to the * Load Balancer. The `stickySessions` block is documented below. Only 1 stickySessions block is allowed. */ stickySessions?: pulumi.Input<inputs.LoadBalancerStickySessions>; /** * A list of Load Balancer IDs to be attached behind a Global Load Balancer. */ targetLoadBalancerIds?: pulumi.Input<pulumi.Input<string>[]>; /** * The tls cipher policy controls the cipher suites to be used by the load balancer. It must be either of `DEFAULT` or `STRONG`. Defaults to `DEFAULT`. */ tlsCipherPolicy?: pulumi.Input<string>; /** * The type of the Load Balancer. It must be either of `REGIONAL`, `REGIONAL_NETWORK`, or `GLOBAL`. Defaults to `REGIONAL`. */ type?: pulumi.Input<string>; /** * The ID of the VPC where the load balancer will be located. */ vpcUuid?: pulumi.Input<string>; } /** * The set of arguments for constructing a LoadBalancer resource. */ export interface LoadBalancerArgs { /** * **Deprecated** This field has been deprecated. You can no longer specify an algorithm for load balancers. * or `leastConnections`. The default value is `roundRobin`. * * @deprecated This field has been deprecated. You can no longer specify an algorithm for load balancers. */ algorithm?: pulumi.Input<string | enums.Algorithm>; /** * A boolean value indicating whether to disable automatic DNS record creation for Let's Encrypt certificates that are added to the load balancer. Default value is `false`. */ disableLetsEncryptDnsRecords?: pulumi.Input<boolean>; /** * A list of `domains` required to ingress traffic to a Global Load Balancer. The `domains` block is documented below. */ domains?: pulumi.Input<pulumi.Input<inputs.LoadBalancerDomain>[]>; /** * A list of the IDs of each droplet to be attached to the Load Balancer. */ dropletIds?: pulumi.Input<pulumi.Input<number>[]>; /** * The name of a Droplet tag corresponding to Droplets to be assigned to the Load Balancer. */ dropletTag?: pulumi.Input<string>; /** * A boolean value indicating whether HTTP keepalive connections are maintained to target Droplets. Default value is `false`. */ enableBackendKeepalive?: pulumi.Input<boolean>; /** * A boolean value indicating whether PROXY * Protocol should be used to pass information from connecting client requests to * the backend service. Default value is `false`. */ enableProxyProtocol?: pulumi.Input<boolean>; /** * A block containing rules for allowing/denying traffic to the Load Balancer. The `firewall` block is documented below. Only 1 firewall is allowed. */ firewall?: pulumi.Input<inputs.LoadBalancerFirewall>; /** * A list of `forwardingRule` to be assigned to the * Load Balancer. The `forwardingRule` block is documented below. */ forwardingRules?: pulumi.Input<pulumi.Input<inputs.LoadBalancerForwardingRule>[]>; /** * A block containing `glbSettings` required to define target rules for a Global Load Balancer. The `glbSettings` block is documented below. */ glbSettings?: pulumi.Input<inputs.LoadBalancerGlbSettings>; /** * A `healthcheck` block to be assigned to the * Load Balancer. The `healthcheck` block is documented below. Only 1 healthcheck is allowed. */ healthcheck?: pulumi.Input<inputs.LoadBalancerHealthcheck>; /** * Specifies the idle timeout for HTTPS connections on the load balancer in seconds. */ httpIdleTimeoutSeconds?: pulumi.Input<number>; /** * The Load Balancer name */ name?: pulumi.Input<string>; /** * The type of network the Load Balancer is accessible from. It must be either of `INTERNAL` or `EXTERNAL`. Defaults to `EXTERNAL`. */ network?: pulumi.Input<string>; /** * The network stack determines the allocation of ipv4/ipv6 addresses to the load balancer. It must be either of `IPV4` or `DUALSTACK`. Defaults to `IPV4`. */ networkStack?: pulumi.Input<string>; /** * The ID of the project that the load balancer is associated with. If no ID is provided at creation, the load balancer associates with the user's default project. */ projectId?: pulumi.Input<string>; /** * A boolean value indicating whether * HTTP requests to the Load Balancer on port 80 will be redirected to HTTPS on port 443. * Default value is `false`. */ redirectHttpToHttps?: pulumi.Input<boolean>; /** * The region to start in */ region?: pulumi.Input<string | enums.Region>; /** * The size of the Load Balancer. It must be either `lb-small`, `lb-medium`, or `lb-large`. Defaults to `lb-small`. Only one of `size` or `sizeUnit` may be provided. */ size?: pulumi.Input<string>; /** * The size of the Load Balancer. It must be in the range (1, 200). Defaults to `1`. Only one of `size` or `sizeUnit` may be provided. */ sizeUnit?: pulumi.Input<number>; /** * A `stickySessions` block to be assigned to the * Load Balancer. The `stickySessions` block is documented below. Only 1 stickySessions block is allowed. */ stickySessions?: pulumi.Input<inputs.LoadBalancerStickySessions>; /** * A list of Load Balancer IDs to be attached behind a Global Load Balancer. */ targetLoadBalancerIds?: pulumi.Input<pulumi.Input<string>[]>; /** * The tls cipher policy controls the cipher suites to be used by the load balancer. It must be either of `DEFAULT` or `STRONG`. Defaults to `DEFAULT`. */ tlsCipherPolicy?: pulumi.Input<string>; /** * The type of the Load Balancer. It must be either of `REGIONAL`, `REGIONAL_NETWORK`, or `GLOBAL`. Defaults to `REGIONAL`. */ type?: pulumi.Input<string>; /** * The ID of the VPC where the load balancer will be located. */ vpcUuid?: pulumi.Input<string>; }