@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
250 lines • 10.9 kB
JavaScript
// *** 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.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 Networks, Subnets, Interconnect attachments or VPN Tunnels.
*
* ## Example Usage
*
* ### 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 Network 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-network-test-network"});
* const network_test = new gcp.networkmanagement.VpcFlowLogsConfig("network-test", {
* vpcFlowLogsConfigId: "basic-network-test-id",
* location: "global",
* network: pulumi.all([project, network.name]).apply(([project, name]) => `projects/${project.number}/global/networks/${name}`),
* });
* ```
* ### Network Management Vpc Flow Logs Config Subnet 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-subnet-test-network",
* autoCreateSubnetworks: false,
* });
* const subnetwork = new gcp.compute.Subnetwork("subnetwork", {
* name: "basic-subnet-test-subnetwork",
* ipCidrRange: "10.2.0.0/16",
* region: "us-central1",
* network: network.id,
* });
* const subnet_test = new gcp.networkmanagement.VpcFlowLogsConfig("subnet-test", {
* vpcFlowLogsConfigId: "basic-subnet-test-id",
* location: "global",
* subnet: pulumi.all([project, subnetwork.name]).apply(([project, name]) => `projects/${project.number}/regions/us-central1/subnetworks/${name}`),
* });
* ```
*
* ## 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, { ...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?.aggregationInterval;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["description"] = state?.description;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["filterExpr"] = state?.filterExpr;
resourceInputs["flowSampling"] = state?.flowSampling;
resourceInputs["interconnectAttachment"] = state?.interconnectAttachment;
resourceInputs["labels"] = state?.labels;
resourceInputs["location"] = state?.location;
resourceInputs["metadata"] = state?.metadata;
resourceInputs["metadataFields"] = state?.metadataFields;
resourceInputs["name"] = state?.name;
resourceInputs["network"] = state?.network;
resourceInputs["project"] = state?.project;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["state"] = state?.state;
resourceInputs["subnet"] = state?.subnet;
resourceInputs["targetResourceState"] = state?.targetResourceState;
resourceInputs["updateTime"] = state?.updateTime;
resourceInputs["vpcFlowLogsConfigId"] = state?.vpcFlowLogsConfigId;
resourceInputs["vpnTunnel"] = state?.vpnTunnel;
}
else {
const args = argsOrState;
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.vpcFlowLogsConfigId === undefined && !opts.urn) {
throw new Error("Missing required property 'vpcFlowLogsConfigId'");
}
resourceInputs["aggregationInterval"] = args?.aggregationInterval;
resourceInputs["description"] = args?.description;
resourceInputs["filterExpr"] = args?.filterExpr;
resourceInputs["flowSampling"] = args?.flowSampling;
resourceInputs["interconnectAttachment"] = args?.interconnectAttachment;
resourceInputs["labels"] = args?.labels;
resourceInputs["location"] = args?.location;
resourceInputs["metadata"] = args?.metadata;
resourceInputs["metadataFields"] = args?.metadataFields;
resourceInputs["network"] = args?.network;
resourceInputs["project"] = args?.project;
resourceInputs["state"] = args?.state;
resourceInputs["subnet"] = args?.subnet;
resourceInputs["vpcFlowLogsConfigId"] = args?.vpcFlowLogsConfigId;
resourceInputs["vpnTunnel"] = args?.vpnTunnel;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["targetResourceState"] = 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
;