UNPKG

@pulumi/linode

Version:

A Pulumi package for creating and managing linode cloud resources.

145 lines (144 loc) 5.38 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manages IPs shared to a Linode instance. * For more information, see the [Linode APIv4 docs](https://techdocs.akamai.com/linode-api/reference/post-share-ips). * * > **Beta Notice** IPv6 sharing is currently available through early access. * To use early access resources, the `apiVersion` provider argument must be set to `v4beta`. * To learn more, see the early access documentation. * * > **Notice** This resource should only be defined once per-instance and should not be used alongside the `sharedIpv4` field in `linode.Instance`. * * ## Example Usage * * Share in IPv4 address between two instances: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * // Create a single primary node * const primaryInstance = new linode.Instance("primary", { * label: "node-primary", * type: "g6-nanode-1", * region: "eu-central", * }); * // Allocate an IP under the primary node * const primary = new linode.InstanceIp("primary", {linodeId: primaryInstance.id}); * // Create a secondary node * const secondary = new linode.Instance("secondary", { * label: "node-secondary", * type: "g6-nanode-1", * region: "eu-central", * }); * // Share the IP with the secondary node * const share_primary = new linode.InstanceSharedIps("share-primary", { * linodeId: secondary.id, * addresses: [primary.address], * }); * ``` * * Share an IPv6 address among a primary node and its replicas: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as linode from "@pulumi/linode"; * * // Create a single primary node * const primary = new linode.Instance("primary", { * label: "node-primary", * type: "g6-nanode-1", * region: "eu-central", * }); * // Allocate an IPv6 range pointing at the primary node * const rangeIpv6Range = new linode.Ipv6Range("range", { * prefixLength: 64, * linodeId: primary.id, * }); * // Share with primary node * const share_primary = new linode.InstanceSharedIps("share-primary", { * linodeId: primary.id, * addresses: [rangeIpv6Range.range], * }); * const config = new pulumi.Config(); * const numberReplicas = config.getNumber("numberReplicas") || 2; * // Create two secondary nodes * const secondary: linode.Instance[] = []; * for (const range = {value: 0}; range.value < numberReplicas; range.value++) { * secondary.push(new linode.Instance(`secondary-${range.value}`, { * label: `node-secondary-${range.value}`, * type: "g6-nanode-1", * region: "eu-central", * })); * } * // Share with secondary nodes * const share_secondary: linode.InstanceSharedIps[] = []; * for (const range = {value: 0}; range.value < numberReplicas; range.value++) { * share_secondary.push(new linode.InstanceSharedIps(`share-secondary-${range.value}`, { * linodeId: secondary[range.value].id, * addresses: [rangeIpv6Range.range], * }, { * dependsOn: [share_primary], * })); * } * ``` */ export declare class InstanceSharedIps extends pulumi.CustomResource { /** * Get an existing InstanceSharedIps 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?: InstanceSharedIpsState, opts?: pulumi.CustomResourceOptions): InstanceSharedIps; /** * Returns true if the given object is an instance of InstanceSharedIps. 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 InstanceSharedIps; /** * The set of IPs to share with the Linode. */ readonly addresses: pulumi.Output<string[]>; /** * The ID of the Linode to share the IPs to. */ readonly linodeId: pulumi.Output<number>; /** * Create a InstanceSharedIps 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: InstanceSharedIpsArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering InstanceSharedIps resources. */ export interface InstanceSharedIpsState { /** * The set of IPs to share with the Linode. */ addresses?: pulumi.Input<pulumi.Input<string>[]>; /** * The ID of the Linode to share the IPs to. */ linodeId?: pulumi.Input<number>; } /** * The set of arguments for constructing a InstanceSharedIps resource. */ export interface InstanceSharedIpsArgs { /** * The set of IPs to share with the Linode. */ addresses: pulumi.Input<pulumi.Input<string>[]>; /** * The ID of the Linode to share the IPs to. */ linodeId: pulumi.Input<number>; }