UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

193 lines 7.01 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.PacketMirroring = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Packet Mirroring mirrors traffic to and from particular VM instances. * You can use the collected traffic to help you detect security threats * and monitor application performance. * * To get more information about PacketMirroring, see: * * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/packetMirrorings) * * How-to Guides * * [Using Packet Mirroring](https://cloud.google.com/vpc/docs/using-packet-mirroring#creating) * * ## Example Usage * * ### Compute Packet Mirroring Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const _default = new gcp.compute.Network("default", {name: "my-network"}); * const mirror = new gcp.compute.Instance("mirror", { * networkInterfaces: [{ * accessConfigs: [{}], * network: _default.id, * }], * name: "my-instance", * machineType: "e2-medium", * bootDisk: { * initializeParams: { * image: "debian-cloud/debian-11", * }, * }, * }); * const defaultSubnetwork = new gcp.compute.Subnetwork("default", { * name: "my-subnetwork", * network: _default.id, * ipCidrRange: "10.2.0.0/16", * }); * const defaultHealthCheck = new gcp.compute.HealthCheck("default", { * name: "my-healthcheck", * checkIntervalSec: 1, * timeoutSec: 1, * tcpHealthCheck: { * port: 80, * }, * }); * const defaultRegionBackendService = new gcp.compute.RegionBackendService("default", { * name: "my-service", * healthChecks: defaultHealthCheck.id, * }); * const defaultForwardingRule = new gcp.compute.ForwardingRule("default", { * name: "my-ilb", * isMirroringCollector: true, * ipProtocol: "TCP", * loadBalancingScheme: "INTERNAL", * backendService: defaultRegionBackendService.id, * allPorts: true, * network: _default.id, * subnetwork: defaultSubnetwork.id, * networkTier: "PREMIUM", * }, { * dependsOn: [defaultSubnetwork], * }); * const foobar = new gcp.compute.PacketMirroring("foobar", { * name: "my-mirroring", * description: "bar", * network: { * url: _default.id, * }, * collectorIlb: { * url: defaultForwardingRule.id, * }, * mirroredResources: { * tags: ["foo"], * instances: [{ * url: mirror.id, * }], * subnetworks: [{ * url: defaultSubnetwork.id, * }], * }, * filter: { * ipProtocols: ["tcp"], * cidrRanges: ["0.0.0.0/0"], * direction: "BOTH", * }, * }); * ``` * * ## Import * * PacketMirroring can be imported using any of these accepted formats: * * * `projects/{{project}}/regions/{{region}}/packetMirrorings/{{name}}` * * * `{{project}}/{{region}}/{{name}}` * * * `{{region}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, PacketMirroring can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/packetMirroring:PacketMirroring default projects/{{project}}/regions/{{region}}/packetMirrorings/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/packetMirroring:PacketMirroring default {{project}}/{{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/packetMirroring:PacketMirroring default {{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/packetMirroring:PacketMirroring default {{name}} * ``` */ class PacketMirroring extends pulumi.CustomResource { /** * Get an existing PacketMirroring 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 PacketMirroring(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of PacketMirroring. 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'] === PacketMirroring.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["collectorIlb"] = state?.collectorIlb; resourceInputs["description"] = state?.description; resourceInputs["filter"] = state?.filter; resourceInputs["mirroredResources"] = state?.mirroredResources; resourceInputs["name"] = state?.name; resourceInputs["network"] = state?.network; resourceInputs["priority"] = state?.priority; resourceInputs["project"] = state?.project; resourceInputs["region"] = state?.region; } else { const args = argsOrState; if (args?.collectorIlb === undefined && !opts.urn) { throw new Error("Missing required property 'collectorIlb'"); } if (args?.mirroredResources === undefined && !opts.urn) { throw new Error("Missing required property 'mirroredResources'"); } if (args?.network === undefined && !opts.urn) { throw new Error("Missing required property 'network'"); } resourceInputs["collectorIlb"] = args?.collectorIlb; resourceInputs["description"] = args?.description; resourceInputs["filter"] = args?.filter; resourceInputs["mirroredResources"] = args?.mirroredResources; resourceInputs["name"] = args?.name; resourceInputs["network"] = args?.network; resourceInputs["priority"] = args?.priority; resourceInputs["project"] = args?.project; resourceInputs["region"] = args?.region; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(PacketMirroring.__pulumiType, name, resourceInputs, opts); } } exports.PacketMirroring = PacketMirroring; /** @internal */ PacketMirroring.__pulumiType = 'gcp:compute/packetMirroring:PacketMirroring'; //# sourceMappingURL=packetMirroring.js.map