UNPKG

@equinix-labs/pulumi-equinix

Version:

A Pulumi package for creating and managing equinix cloud resources.

127 lines 5.15 kB
"use strict"; // *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.BgpSession = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage BGP sessions in Equinix Metal Host. Refer to [Equinix Metal BGP documentation](https://metal.equinix.com/developers/docs/networking/local-global-bgp/) for more details. * * You need to have BGP config enabled in your project. * * BGP session must be linked to a device running [BIRD](https://bird.network.cz) or other BGP routing daemon which will control route advertisements via the session to Equinix Metal's upstream routers. * * ## Example Usage * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as _null from "@pulumi/null"; * import * as equinix from "@equinix-labs/pulumi-equinix"; * * const bgpPassword = "955dB0b81Ef"; * const projectId = "<UUID_of_your_project>"; * const addr = new equinix.metal.ReservedIpBlock("addr", { * projectId: projectId, * metro: "ny", * quantity: 1, * }); * const interfaceLo0 = pulumi.interpolate`auto lo:0 * iface lo:0 inet static * address ${addr.address} * netmask ${addr.netmask} * `; * const test = new equinix.metal.Device("test", { * hostname: "terraform-test-bgp-sesh", * plan: equinix.metal.Plan.C3SmallX86, * metro: "ny", * operatingSystem: equinix.metal.OperatingSystem.Ubuntu20_04, * billingCycle: equinix.metal.BillingCycle.Hourly, * projectId: projectId, * }); * const birdConf = pulumi.all([addr.address, addr.cidr, test.network, test.network]).apply(([address, cidr, testNetwork, testNetwork1]) => `filter equinix_metal_bgp { * if net = ${address}/${cidr} then accept; * } * router id ${testNetwork[2].address}; * protocol direct { * interface "lo"; * } * protocol kernel { * scan time 10; * persist; * import all; * export all; * } * protocol device { * scan time 10; * } * protocol bgp { * export filter equinix_metal_bgp; * local as 65000; * neighbor ${testNetwork1[2].gateway} as 65530; * password "${bgpPassword}"; * } * `); * const testBgpSession = new equinix.metal.BgpSession("testBgpSession", { * deviceId: test.id, * addressFamily: "ipv4", * }); * const configureBird = new _null.Resource("configureBird", {triggers: { * bird_conf: birdConf, * "interface": interfaceLo0, * }}); * ``` */ class BgpSession extends pulumi.CustomResource { /** * Get an existing BgpSession 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, id, state, opts) { return new BgpSession(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of BgpSession. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === BgpSession.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["addressFamily"] = state ? state.addressFamily : undefined; resourceInputs["defaultRoute"] = state ? state.defaultRoute : undefined; resourceInputs["deviceId"] = state ? state.deviceId : undefined; resourceInputs["status"] = state ? state.status : undefined; } else { const args = argsOrState; if ((!args || args.addressFamily === undefined) && !opts.urn) { throw new Error("Missing required property 'addressFamily'"); } if ((!args || args.deviceId === undefined) && !opts.urn) { throw new Error("Missing required property 'deviceId'"); } resourceInputs["addressFamily"] = args ? args.addressFamily : undefined; resourceInputs["defaultRoute"] = args ? args.defaultRoute : undefined; resourceInputs["deviceId"] = args ? args.deviceId : undefined; resourceInputs["status"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(BgpSession.__pulumiType, name, resourceInputs, opts); } } exports.BgpSession = BgpSession; /** @internal */ BgpSession.__pulumiType = 'equinix:metal/bgpSession:BgpSession'; //# sourceMappingURL=bgpSession.js.map