UNPKG

@pulumi/gcp

Version:

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

303 lines • 13.2 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.VpcFlowLogsConfig = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * VPC Flow Logs Config is a resource that lets you configure Flow Logs for VPC, Interconnect attachments or VPN Tunnels. * * ## Example Usage * * ### Network Management Vpc Flow Logs Config Interconnect Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const network = new gcp.compute.Network("network", {name: "full-interconnect-test-network"}); * const router = new gcp.compute.Router("router", { * name: "full-interconnect-test-router", * network: network.name, * bgp: { * asn: 16550, * }, * }); * const attachment = new gcp.compute.InterconnectAttachment("attachment", { * name: "full-interconnect-test-id", * edgeAvailabilityDomain: "AVAILABILITY_DOMAIN_1", * type: "PARTNER", * router: router.id, * mtu: "1500", * }); * const interconnect_test = new gcp.networkmanagement.VpcFlowLogsConfig("interconnect-test", { * vpcFlowLogsConfigId: "full-interconnect-test-id", * location: "global", * interconnectAttachment: pulumi.all([project, attachment.name]).apply(([project, name]) => `projects/${project.number}/regions/us-east4/interconnectAttachments/${name}`), * state: "ENABLED", * aggregationInterval: "INTERVAL_5_SEC", * description: "VPC Flow Logs over a VPN Gateway.", * flowSampling: 0.5, * metadata: "INCLUDE_ALL_METADATA", * }); * ``` * ### Network Management Vpc Flow Logs Config Interconnect Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const network = new gcp.compute.Network("network", {name: "basic-interconnect-test-network"}); * const router = new gcp.compute.Router("router", { * name: "basic-interconnect-test-router", * network: network.name, * bgp: { * asn: 16550, * }, * }); * const attachment = new gcp.compute.InterconnectAttachment("attachment", { * name: "basic-interconnect-test-id", * edgeAvailabilityDomain: "AVAILABILITY_DOMAIN_1", * type: "PARTNER", * router: router.id, * mtu: "1500", * }); * const interconnect_test = new gcp.networkmanagement.VpcFlowLogsConfig("interconnect-test", { * vpcFlowLogsConfigId: "basic-interconnect-test-id", * location: "global", * interconnectAttachment: pulumi.all([project, attachment.name]).apply(([project, name]) => `projects/${project.number}/regions/us-east4/interconnectAttachments/${name}`), * }); * ``` * ### Network Management Vpc Flow Logs Config Vpn Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const network = new gcp.compute.Network("network", {name: "basic-test-network"}); * const targetGateway = new gcp.compute.VPNGateway("target_gateway", { * name: "basic-test-gateway", * network: network.id, * }); * const vpnStaticIp = new gcp.compute.Address("vpn_static_ip", {name: "basic-test-address"}); * const frEsp = new gcp.compute.ForwardingRule("fr_esp", { * name: "basic-test-fresp", * ipProtocol: "ESP", * ipAddress: vpnStaticIp.address, * target: targetGateway.id, * }); * const frUdp500 = new gcp.compute.ForwardingRule("fr_udp500", { * name: "basic-test-fr500", * ipProtocol: "UDP", * portRange: "500", * ipAddress: vpnStaticIp.address, * target: targetGateway.id, * }); * const frUdp4500 = new gcp.compute.ForwardingRule("fr_udp4500", { * name: "basic-test-fr4500", * ipProtocol: "UDP", * portRange: "4500", * ipAddress: vpnStaticIp.address, * target: targetGateway.id, * }); * const tunnel = new gcp.compute.VPNTunnel("tunnel", { * name: "basic-test-tunnel", * peerIp: "15.0.0.120", * sharedSecret: "a secret message", * targetVpnGateway: targetGateway.id, * }, { * dependsOn: [ * frEsp, * frUdp500, * frUdp4500, * ], * }); * const vpn_test = new gcp.networkmanagement.VpcFlowLogsConfig("vpn-test", { * vpcFlowLogsConfigId: "basic-test-id", * location: "global", * vpnTunnel: pulumi.all([project, tunnel.name]).apply(([project, name]) => `projects/${project.number}/regions/us-central1/vpnTunnels/${name}`), * }); * const route = new gcp.compute.Route("route", { * name: "basic-test-route", * network: network.name, * destRange: "15.0.0.0/24", * priority: 1000, * nextHopVpnTunnel: tunnel.id, * }); * ``` * ### Network Management Vpc Flow Logs Config Vpn Full * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const network = new gcp.compute.Network("network", {name: "full-test-network"}); * const targetGateway = new gcp.compute.VPNGateway("target_gateway", { * name: "full-test-gateway", * network: network.id, * }); * const vpnStaticIp = new gcp.compute.Address("vpn_static_ip", {name: "full-test-address"}); * const frEsp = new gcp.compute.ForwardingRule("fr_esp", { * name: "full-test-fresp", * ipProtocol: "ESP", * ipAddress: vpnStaticIp.address, * target: targetGateway.id, * }); * const frUdp500 = new gcp.compute.ForwardingRule("fr_udp500", { * name: "full-test-fr500", * ipProtocol: "UDP", * portRange: "500", * ipAddress: vpnStaticIp.address, * target: targetGateway.id, * }); * const frUdp4500 = new gcp.compute.ForwardingRule("fr_udp4500", { * name: "full-test-fr4500", * ipProtocol: "UDP", * portRange: "4500", * ipAddress: vpnStaticIp.address, * target: targetGateway.id, * }); * const tunnel = new gcp.compute.VPNTunnel("tunnel", { * name: "full-test-tunnel", * peerIp: "15.0.0.120", * sharedSecret: "a secret message", * targetVpnGateway: targetGateway.id, * }, { * dependsOn: [ * frEsp, * frUdp500, * frUdp4500, * ], * }); * const vpn_test = new gcp.networkmanagement.VpcFlowLogsConfig("vpn-test", { * vpcFlowLogsConfigId: "full-test-id", * location: "global", * vpnTunnel: pulumi.all([project, tunnel.name]).apply(([project, name]) => `projects/${project.number}/regions/us-central1/vpnTunnels/${name}`), * state: "ENABLED", * aggregationInterval: "INTERVAL_5_SEC", * description: "VPC Flow Logs over a VPN Gateway.", * flowSampling: 0.5, * metadata: "INCLUDE_ALL_METADATA", * }); * const route = new gcp.compute.Route("route", { * name: "full-test-route", * network: network.name, * destRange: "15.0.0.0/24", * priority: 1000, * nextHopVpnTunnel: tunnel.id, * }); * ``` * * ## Import * * VpcFlowLogsConfig can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs/{{vpc_flow_logs_config_id}}` * * * `{{project}}/{{location}}/{{vpc_flow_logs_config_id}}` * * * `{{location}}/{{vpc_flow_logs_config_id}}` * * When using the `pulumi import` command, VpcFlowLogsConfig can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default projects/{{project}}/locations/{{location}}/vpcFlowLogsConfigs/{{vpc_flow_logs_config_id}} * ``` * * ```sh * $ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default {{project}}/{{location}}/{{vpc_flow_logs_config_id}} * ``` * * ```sh * $ pulumi import gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig default {{location}}/{{vpc_flow_logs_config_id}} * ``` */ class VpcFlowLogsConfig extends pulumi.CustomResource { /** * Get an existing VpcFlowLogsConfig 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 VpcFlowLogsConfig(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of VpcFlowLogsConfig. 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'] === VpcFlowLogsConfig.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["aggregationInterval"] = state ? state.aggregationInterval : undefined; resourceInputs["createTime"] = state ? state.createTime : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined; resourceInputs["filterExpr"] = state ? state.filterExpr : undefined; resourceInputs["flowSampling"] = state ? state.flowSampling : undefined; resourceInputs["interconnectAttachment"] = state ? state.interconnectAttachment : undefined; resourceInputs["labels"] = state ? state.labels : undefined; resourceInputs["location"] = state ? state.location : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["metadataFields"] = state ? state.metadataFields : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["updateTime"] = state ? state.updateTime : undefined; resourceInputs["vpcFlowLogsConfigId"] = state ? state.vpcFlowLogsConfigId : undefined; resourceInputs["vpnTunnel"] = state ? state.vpnTunnel : undefined; } else { const args = argsOrState; if ((!args || args.location === undefined) && !opts.urn) { throw new Error("Missing required property 'location'"); } if ((!args || args.vpcFlowLogsConfigId === undefined) && !opts.urn) { throw new Error("Missing required property 'vpcFlowLogsConfigId'"); } resourceInputs["aggregationInterval"] = args ? args.aggregationInterval : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["filterExpr"] = args ? args.filterExpr : undefined; resourceInputs["flowSampling"] = args ? args.flowSampling : undefined; resourceInputs["interconnectAttachment"] = args ? args.interconnectAttachment : undefined; resourceInputs["labels"] = args ? args.labels : undefined; resourceInputs["location"] = args ? args.location : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["metadataFields"] = args ? args.metadataFields : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["state"] = args ? args.state : undefined; resourceInputs["vpcFlowLogsConfigId"] = args ? args.vpcFlowLogsConfigId : undefined; resourceInputs["vpnTunnel"] = args ? args.vpnTunnel : undefined; resourceInputs["createTime"] = undefined /*out*/; resourceInputs["effectiveLabels"] = undefined /*out*/; resourceInputs["name"] = undefined /*out*/; resourceInputs["pulumiLabels"] = undefined /*out*/; resourceInputs["updateTime"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] }; opts = pulumi.mergeOptions(opts, secretOpts); super(VpcFlowLogsConfig.__pulumiType, name, resourceInputs, opts); } } exports.VpcFlowLogsConfig = VpcFlowLogsConfig; /** @internal */ VpcFlowLogsConfig.__pulumiType = 'gcp:networkmanagement/vpcFlowLogsConfig:VpcFlowLogsConfig'; //# sourceMappingURL=vpcFlowLogsConfig.js.map