"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.Subnetwork = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A VPC network is a virtual version of the traditional physical networks
 * that exist within and between physical data centers. A VPC network
 * provides connectivity for your Compute Engine virtual machine (VM)
 * instances, Container Engine containers, App Engine Flex services, and
 * other network-related resources.
 *
 * Each GCP project contains one or more VPC networks. Each VPC network is a
 * global entity spanning all GCP regions. This global VPC network allows VM
 * instances and other resources to communicate with each other via internal,
 * private IP addresses.
 *
 * Each VPC network is subdivided into subnets, and each subnet is contained
 * within a single region. You can have more than one subnet in a region for
 * a given VPC network. Each subnet has a contiguous private RFC1918 IP
 * space. You create instances, containers, and the like in these subnets.
 * When you create an instance, you must create it in a subnet, and the
 * instance draws its internal IP address from that subnet.
 *
 * Virtual machine (VM) instances in a VPC network can communicate with
 * instances in all other subnets of the same VPC network, regardless of
 * region, using their RFC1918 private IP addresses. You can isolate portions
 * of the network, even entire subnets, using firewall rules.
 *
 * To get more information about Subnetwork, see:
 *
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/subnetworks)
 * * How-to Guides
 *     * [Cloud Networking](https://cloud.google.com/vpc/docs/using-vpc)
 *     * [Private Google Access](https://cloud.google.com/vpc/docs/configure-private-google-access)
 *
 * ## Example Usage
 *
 * ### Subnetwork Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const custom_test = new gcp.compute.Network("custom-test", {
 *     name: "test-network",
 *     autoCreateSubnetworks: false,
 * });
 * const network_with_private_secondary_ip_ranges = new gcp.compute.Subnetwork("network-with-private-secondary-ip-ranges", {
 *     name: "test-subnetwork",
 *     ipCidrRange: "10.2.0.0/16",
 *     region: "us-central1",
 *     network: custom_test.id,
 *     secondaryIpRanges: [{
 *         rangeName: "tf-test-secondary-range-update1",
 *         ipCidrRange: "192.168.10.0/24",
 *     }],
 * });
 * ```
 * ### Subnetwork Logging Config
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const custom_test = new gcp.compute.Network("custom-test", {
 *     name: "log-test-network",
 *     autoCreateSubnetworks: false,
 * });
 * const subnet_with_logging = new gcp.compute.Subnetwork("subnet-with-logging", {
 *     name: "log-test-subnetwork",
 *     ipCidrRange: "10.2.0.0/16",
 *     region: "us-central1",
 *     network: custom_test.id,
 *     logConfig: {
 *         aggregationInterval: "INTERVAL_10_MIN",
 *         flowSampling: 0.5,
 *         metadata: "INCLUDE_ALL_METADATA",
 *     },
 * });
 * ```
 * ### Subnetwork Internal L7lb
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const custom_test = new gcp.compute.Network("custom-test", {
 *     name: "l7lb-test-network",
 *     autoCreateSubnetworks: false,
 * });
 * const network_for_l7lb = new gcp.compute.Subnetwork("network-for-l7lb", {
 *     name: "l7lb-test-subnetwork",
 *     ipCidrRange: "10.0.0.0/22",
 *     region: "us-central1",
 *     purpose: "REGIONAL_MANAGED_PROXY",
 *     role: "ACTIVE",
 *     network: custom_test.id,
 * });
 * ```
 * ### Subnetwork Ipv6
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const custom_test = new gcp.compute.Network("custom-test", {
 *     name: "ipv6-test-network",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetwork_ipv6 = new gcp.compute.Subnetwork("subnetwork-ipv6", {
 *     name: "ipv6-test-subnetwork",
 *     ipCidrRange: "10.0.0.0/22",
 *     region: "us-west2",
 *     stackType: "IPV4_IPV6",
 *     ipv6AccessType: "EXTERNAL",
 *     network: custom_test.id,
 * });
 * ```
 * ### Subnetwork Internal Ipv6
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const custom_test = new gcp.compute.Network("custom-test", {
 *     name: "internal-ipv6-test-network",
 *     autoCreateSubnetworks: false,
 *     enableUlaInternalIpv6: true,
 * });
 * const subnetwork_internal_ipv6 = new gcp.compute.Subnetwork("subnetwork-internal-ipv6", {
 *     name: "internal-ipv6-test-subnetwork",
 *     ipCidrRange: "10.0.0.0/22",
 *     region: "us-west2",
 *     stackType: "IPV4_IPV6",
 *     ipv6AccessType: "INTERNAL",
 *     network: custom_test.id,
 * });
 * ```
 * ### Subnetwork Purpose Private Nat
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const custom_test = new gcp.compute.Network("custom-test", {
 *     name: "subnet-purpose-test-network",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetwork_purpose_private_nat = new gcp.compute.Subnetwork("subnetwork-purpose-private-nat", {
 *     name: "subnet-purpose-test-subnetwork",
 *     region: "us-west2",
 *     ipCidrRange: "192.168.1.0/24",
 *     purpose: "PRIVATE_NAT",
 *     network: custom_test.id,
 * });
 * ```
 * ### Subnetwork Cidr Overlap
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const net_cidr_overlap = new gcp.compute.Network("net-cidr-overlap", {
 *     name: "net-cidr-overlap",
 *     autoCreateSubnetworks: false,
 * });
 * const subnetwork_cidr_overlap = new gcp.compute.Subnetwork("subnetwork-cidr-overlap", {
 *     name: "subnet-cidr-overlap",
 *     region: "us-west2",
 *     ipCidrRange: "192.168.1.0/24",
 *     allowSubnetCidrRoutesOverlap: true,
 *     network: net_cidr_overlap.id,
 * });
 * ```
 * ### Subnetwork Reserved Internal Range
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {
 *     name: "network-reserved-internal-range",
 *     autoCreateSubnetworks: false,
 * });
 * const reserved = new gcp.networkconnectivity.InternalRange("reserved", {
 *     name: "reserved",
 *     network: _default.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     prefixLength: 24,
 *     targetCidrRanges: ["10.0.0.0/8"],
 * });
 * const subnetwork_reserved_internal_range = new gcp.compute.Subnetwork("subnetwork-reserved-internal-range", {
 *     name: "subnetwork-reserved-internal-range",
 *     region: "us-central1",
 *     network: _default.id,
 *     reservedInternalRange: pulumi.interpolate`networkconnectivity.googleapis.com/${reserved.id}`,
 * });
 * ```
 * ### Subnetwork Reserved Secondary Range
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const _default = new gcp.compute.Network("default", {
 *     name: "network-reserved-secondary-range",
 *     autoCreateSubnetworks: false,
 * });
 * const reserved = new gcp.networkconnectivity.InternalRange("reserved", {
 *     name: "reserved-primary",
 *     network: _default.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     prefixLength: 24,
 *     targetCidrRanges: ["10.0.0.0/8"],
 * });
 * const reservedSecondary = new gcp.networkconnectivity.InternalRange("reserved_secondary", {
 *     name: "reserved-secondary",
 *     network: _default.id,
 *     usage: "FOR_VPC",
 *     peering: "FOR_SELF",
 *     prefixLength: 16,
 *     targetCidrRanges: ["10.0.0.0/8"],
 * });
 * const subnetwork_reserved_secondary_range = new gcp.compute.Subnetwork("subnetwork-reserved-secondary-range", {
 *     name: "subnetwork-reserved-secondary-range",
 *     region: "us-central1",
 *     network: _default.id,
 *     reservedInternalRange: pulumi.interpolate`networkconnectivity.googleapis.com/${reserved.id}`,
 *     secondaryIpRanges: [{
 *         rangeName: "secondary",
 *         reservedInternalRange: pulumi.interpolate`networkconnectivity.googleapis.com/${reservedSecondary.id}`,
 *     }],
 * });
 * ```
 *
 * ## Import
 *
 * Subnetwork can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/regions/{{region}}/subnetworks/{{name}}`
 *
 * * `{{project}}/{{region}}/{{name}}`
 *
 * * `{{region}}/{{name}}`
 *
 * * `{{name}}`
 *
 * When using the `pulumi import` command, Subnetwork can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:compute/subnetwork:Subnetwork default projects/{{project}}/regions/{{region}}/subnetworks/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/subnetwork:Subnetwork default {{project}}/{{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/subnetwork:Subnetwork default {{region}}/{{name}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:compute/subnetwork:Subnetwork default {{name}}
 * ```
 */
class Subnetwork extends pulumi.CustomResource {
    /**
     * Get an existing Subnetwork 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 Subnetwork(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of Subnetwork.  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'] === Subnetwork.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["allowSubnetCidrRoutesOverlap"] = state?.allowSubnetCidrRoutesOverlap;
            resourceInputs["creationTimestamp"] = state?.creationTimestamp;
            resourceInputs["description"] = state?.description;
            resourceInputs["externalIpv6Prefix"] = state?.externalIpv6Prefix;
            resourceInputs["fingerprint"] = state?.fingerprint;
            resourceInputs["gatewayAddress"] = state?.gatewayAddress;
            resourceInputs["internalIpv6Prefix"] = state?.internalIpv6Prefix;
            resourceInputs["ipCidrRange"] = state?.ipCidrRange;
            resourceInputs["ipCollection"] = state?.ipCollection;
            resourceInputs["ipv6AccessType"] = state?.ipv6AccessType;
            resourceInputs["ipv6CidrRange"] = state?.ipv6CidrRange;
            resourceInputs["ipv6GceEndpoint"] = state?.ipv6GceEndpoint;
            resourceInputs["logConfig"] = state?.logConfig;
            resourceInputs["name"] = state?.name;
            resourceInputs["network"] = state?.network;
            resourceInputs["params"] = state?.params;
            resourceInputs["privateIpGoogleAccess"] = state?.privateIpGoogleAccess;
            resourceInputs["privateIpv6GoogleAccess"] = state?.privateIpv6GoogleAccess;
            resourceInputs["project"] = state?.project;
            resourceInputs["purpose"] = state?.purpose;
            resourceInputs["region"] = state?.region;
            resourceInputs["reservedInternalRange"] = state?.reservedInternalRange;
            resourceInputs["role"] = state?.role;
            resourceInputs["secondaryIpRanges"] = state?.secondaryIpRanges;
            resourceInputs["selfLink"] = state?.selfLink;
            resourceInputs["sendSecondaryIpRangeIfEmpty"] = state?.sendSecondaryIpRangeIfEmpty;
            resourceInputs["stackType"] = state?.stackType;
            resourceInputs["state"] = state?.state;
            resourceInputs["subnetworkId"] = state?.subnetworkId;
        }
        else {
            const args = argsOrState;
            if (args?.network === undefined && !opts.urn) {
                throw new Error("Missing required property 'network'");
            }
            resourceInputs["allowSubnetCidrRoutesOverlap"] = args?.allowSubnetCidrRoutesOverlap;
            resourceInputs["description"] = args?.description;
            resourceInputs["externalIpv6Prefix"] = args?.externalIpv6Prefix;
            resourceInputs["ipCidrRange"] = args?.ipCidrRange;
            resourceInputs["ipCollection"] = args?.ipCollection;
            resourceInputs["ipv6AccessType"] = args?.ipv6AccessType;
            resourceInputs["logConfig"] = args?.logConfig;
            resourceInputs["name"] = args?.name;
            resourceInputs["network"] = args?.network;
            resourceInputs["params"] = args?.params;
            resourceInputs["privateIpGoogleAccess"] = args?.privateIpGoogleAccess;
            resourceInputs["privateIpv6GoogleAccess"] = args?.privateIpv6GoogleAccess;
            resourceInputs["project"] = args?.project;
            resourceInputs["purpose"] = args?.purpose;
            resourceInputs["region"] = args?.region;
            resourceInputs["reservedInternalRange"] = args?.reservedInternalRange;
            resourceInputs["role"] = args?.role;
            resourceInputs["secondaryIpRanges"] = args?.secondaryIpRanges;
            resourceInputs["sendSecondaryIpRangeIfEmpty"] = args?.sendSecondaryIpRangeIfEmpty;
            resourceInputs["stackType"] = args?.stackType;
            resourceInputs["creationTimestamp"] = undefined /*out*/;
            resourceInputs["fingerprint"] = undefined /*out*/;
            resourceInputs["gatewayAddress"] = undefined /*out*/;
            resourceInputs["internalIpv6Prefix"] = undefined /*out*/;
            resourceInputs["ipv6CidrRange"] = undefined /*out*/;
            resourceInputs["ipv6GceEndpoint"] = undefined /*out*/;
            resourceInputs["selfLink"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["subnetworkId"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Subnetwork.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Subnetwork = Subnetwork;
/** @internal */
Subnetwork.__pulumiType = 'gcp:compute/subnetwork:Subnetwork';
//# sourceMappingURL=subnetwork.js.map