UNPKG

@pulumi/gcp

Version:

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

515 lines (514 loc) • 20.8 kB
import * as pulumi from "@pulumi/pulumi"; /** * 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}} * ``` */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: VpcFlowLogsConfigState, opts?: pulumi.CustomResourceOptions): VpcFlowLogsConfig; /** * 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: any): obj is VpcFlowLogsConfig; /** * Optional. The aggregation interval for the logs. Default value is * INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN" */ readonly aggregationInterval: pulumi.Output<string>; /** * Output only. The time the config was created. */ readonly createTime: pulumi.Output<string>; /** * Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum * of 512 characters. */ readonly description: pulumi.Output<string | undefined>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * Optional. Export filter used to define which VPC Flow Logs should be logged. */ readonly filterExpr: pulumi.Output<string | undefined>; /** * Optional. The value of the field must be in (0, 1]. The sampling rate * of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the * sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use * the state field instead. Default value is 1.0. */ readonly flowSampling: pulumi.Output<number>; /** * Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name} */ readonly interconnectAttachment: pulumi.Output<string | undefined>; /** * Optional. Resource labels to represent user-provided metadata. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Resource ID segment making up resource `name`. It identifies the resource * within its parent collection as described in https://google.aip.dev/122. See documentation * for resource type `networkmanagement.googleapis.com/VpcFlowLogsConfig`. */ readonly location: pulumi.Output<string>; /** * Optional. Configures whether all, none or a subset of metadata fields * should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. * Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA */ readonly metadata: pulumi.Output<string>; /** * Optional. Custom metadata fields to include in the reported VPC flow * logs. Can only be specified if \"metadata\" was set to CUSTOM_METADATA. */ readonly metadataFields: pulumi.Output<string[] | undefined>; /** * Identifier. Unique name of the configuration using the form: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` */ readonly name: pulumi.Output<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * Optional. The state of the VPC Flow Log configuration. Default value * is ENABLED. When creating a new configuration, it must be enabled. Possible */ readonly state: pulumi.Output<string>; /** * Output only. The time the config was updated. */ readonly updateTime: pulumi.Output<string>; /** * Required. ID of the `VpcFlowLogsConfig`. * * * - - - */ readonly vpcFlowLogsConfigId: pulumi.Output<string>; /** * Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name} */ readonly vpnTunnel: pulumi.Output<string | undefined>; /** * Create a VpcFlowLogsConfig 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: VpcFlowLogsConfigArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering VpcFlowLogsConfig resources. */ export interface VpcFlowLogsConfigState { /** * Optional. The aggregation interval for the logs. Default value is * INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN" */ aggregationInterval?: pulumi.Input<string>; /** * Output only. The time the config was created. */ createTime?: pulumi.Input<string>; /** * Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum * of 512 characters. */ description?: pulumi.Input<string>; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Optional. Export filter used to define which VPC Flow Logs should be logged. */ filterExpr?: pulumi.Input<string>; /** * Optional. The value of the field must be in (0, 1]. The sampling rate * of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the * sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use * the state field instead. Default value is 1.0. */ flowSampling?: pulumi.Input<number>; /** * Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name} */ interconnectAttachment?: pulumi.Input<string>; /** * Optional. Resource labels to represent user-provided metadata. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Resource ID segment making up resource `name`. It identifies the resource * within its parent collection as described in https://google.aip.dev/122. See documentation * for resource type `networkmanagement.googleapis.com/VpcFlowLogsConfig`. */ location?: pulumi.Input<string>; /** * Optional. Configures whether all, none or a subset of metadata fields * should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. * Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA */ metadata?: pulumi.Input<string>; /** * Optional. Custom metadata fields to include in the reported VPC flow * logs. Can only be specified if \"metadata\" was set to CUSTOM_METADATA. */ metadataFields?: pulumi.Input<pulumi.Input<string>[]>; /** * Identifier. Unique name of the configuration using the form: `projects/{project_id}/locations/global/vpcFlowLogsConfigs/{vpc_flow_logs_config_id}` */ name?: pulumi.Input<string>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Optional. The state of the VPC Flow Log configuration. Default value * is ENABLED. When creating a new configuration, it must be enabled. Possible */ state?: pulumi.Input<string>; /** * Output only. The time the config was updated. */ updateTime?: pulumi.Input<string>; /** * Required. ID of the `VpcFlowLogsConfig`. * * * - - - */ vpcFlowLogsConfigId?: pulumi.Input<string>; /** * Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name} */ vpnTunnel?: pulumi.Input<string>; } /** * The set of arguments for constructing a VpcFlowLogsConfig resource. */ export interface VpcFlowLogsConfigArgs { /** * Optional. The aggregation interval for the logs. Default value is * INTERVAL_5_SEC. Possible values: AGGREGATION_INTERVAL_UNSPECIFIED INTERVAL_5_SEC INTERVAL_30_SEC INTERVAL_1_MIN INTERVAL_5_MIN INTERVAL_10_MIN INTERVAL_15_MIN" */ aggregationInterval?: pulumi.Input<string>; /** * Optional. The user-supplied description of the VPC Flow Logs configuration. Maximum * of 512 characters. */ description?: pulumi.Input<string>; /** * Optional. Export filter used to define which VPC Flow Logs should be logged. */ filterExpr?: pulumi.Input<string>; /** * Optional. The value of the field must be in (0, 1]. The sampling rate * of VPC Flow Logs where 1.0 means all collected logs are reported. Setting the * sampling rate to 0.0 is not allowed. If you want to disable VPC Flow Logs, use * the state field instead. Default value is 1.0. */ flowSampling?: pulumi.Input<number>; /** * Traffic will be logged from the Interconnect Attachment. Format: projects/{project_id}/regions/{region}/interconnectAttachments/{name} */ interconnectAttachment?: pulumi.Input<string>; /** * Optional. Resource labels to represent user-provided metadata. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Resource ID segment making up resource `name`. It identifies the resource * within its parent collection as described in https://google.aip.dev/122. See documentation * for resource type `networkmanagement.googleapis.com/VpcFlowLogsConfig`. */ location: pulumi.Input<string>; /** * Optional. Configures whether all, none or a subset of metadata fields * should be added to the reported VPC flow logs. Default value is INCLUDE_ALL_METADATA. * Possible values: METADATA_UNSPECIFIED INCLUDE_ALL_METADATA EXCLUDE_ALL_METADATA CUSTOM_METADATA */ metadata?: pulumi.Input<string>; /** * Optional. Custom metadata fields to include in the reported VPC flow * logs. Can only be specified if \"metadata\" was set to CUSTOM_METADATA. */ metadataFields?: pulumi.Input<pulumi.Input<string>[]>; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input<string>; /** * Optional. The state of the VPC Flow Log configuration. Default value * is ENABLED. When creating a new configuration, it must be enabled. Possible */ state?: pulumi.Input<string>; /** * Required. ID of the `VpcFlowLogsConfig`. * * * - - - */ vpcFlowLogsConfigId: pulumi.Input<string>; /** * Traffic will be logged from the VPN Tunnel. Format: projects/{project_id}/regions/{region}/vpnTunnels/{name} */ vpnTunnel?: pulumi.Input<string>; }