1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getSubnetwork
Google Cloud Classic v7.2.2 published on Monday, Jan 1, 0001 by Pulumi

gcp.compute.getSubnetwork

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.2.2 published on Monday, Jan 1, 0001 by Pulumi

    Get a subnetwork within GCE from its name and region.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var my_subnetwork = Gcp.Compute.GetSubnetwork.Invoke(new()
        {
            Name = "default-us-east1",
            Region = "us-east1",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.LookupSubnetwork(ctx, &compute.LookupSubnetworkArgs{
    			Name:   pulumi.StringRef("default-us-east1"),
    			Region: pulumi.StringRef("us-east1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.ComputeFunctions;
    import com.pulumi.gcp.compute.inputs.GetSubnetworkArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var my-subnetwork = ComputeFunctions.getSubnetwork(GetSubnetworkArgs.builder()
                .name("default-us-east1")
                .region("us-east1")
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_gcp as gcp
    
    my_subnetwork = gcp.compute.get_subnetwork(name="default-us-east1",
        region="us-east1")
    
    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const my-subnetwork = gcp.compute.getSubnetwork({
        name: "default-us-east1",
        region: "us-east1",
    });
    
    variables:
      my-subnetwork:
        fn::invoke:
          Function: gcp:compute:getSubnetwork
          Arguments:
            name: default-us-east1
            region: us-east1
    

    Using getSubnetwork

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSubnetwork(args: GetSubnetworkArgs, opts?: InvokeOptions): Promise<GetSubnetworkResult>
    function getSubnetworkOutput(args: GetSubnetworkOutputArgs, opts?: InvokeOptions): Output<GetSubnetworkResult>
    def get_subnetwork(name: Optional[str] = None,
                       project: Optional[str] = None,
                       region: Optional[str] = None,
                       self_link: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetSubnetworkResult
    def get_subnetwork_output(name: Optional[pulumi.Input[str]] = None,
                       project: Optional[pulumi.Input[str]] = None,
                       region: Optional[pulumi.Input[str]] = None,
                       self_link: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetSubnetworkResult]
    func LookupSubnetwork(ctx *Context, args *LookupSubnetworkArgs, opts ...InvokeOption) (*LookupSubnetworkResult, error)
    func LookupSubnetworkOutput(ctx *Context, args *LookupSubnetworkOutputArgs, opts ...InvokeOption) LookupSubnetworkResultOutput

    > Note: This function is named LookupSubnetwork in the Go SDK.

    public static class GetSubnetwork 
    {
        public static Task<GetSubnetworkResult> InvokeAsync(GetSubnetworkArgs args, InvokeOptions? opts = null)
        public static Output<GetSubnetworkResult> Invoke(GetSubnetworkInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSubnetworkResult> getSubnetwork(GetSubnetworkArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:compute/getSubnetwork:getSubnetwork
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string

    The name of the subnetwork. One of name or self_link must be specified.

    Project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Region string

    The region this subnetwork has been created in. If unspecified, this defaults to the region configured in the provider.

    SelfLink string

    The self link of the subnetwork. If self_link is specified, name, project, and region are ignored.

    Name string

    The name of the subnetwork. One of name or self_link must be specified.

    Project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Region string

    The region this subnetwork has been created in. If unspecified, this defaults to the region configured in the provider.

    SelfLink string

    The self link of the subnetwork. If self_link is specified, name, project, and region are ignored.

    name String

    The name of the subnetwork. One of name or self_link must be specified.

    project String

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    region String

    The region this subnetwork has been created in. If unspecified, this defaults to the region configured in the provider.

    selfLink String

    The self link of the subnetwork. If self_link is specified, name, project, and region are ignored.

    name string

    The name of the subnetwork. One of name or self_link must be specified.

    project string

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    region string

    The region this subnetwork has been created in. If unspecified, this defaults to the region configured in the provider.

    selfLink string

    The self link of the subnetwork. If self_link is specified, name, project, and region are ignored.

    name str

    The name of the subnetwork. One of name or self_link must be specified.

    project str

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    region str

    The region this subnetwork has been created in. If unspecified, this defaults to the region configured in the provider.

    self_link str

    The self link of the subnetwork. If self_link is specified, name, project, and region are ignored.

    name String

    The name of the subnetwork. One of name or self_link must be specified.

    project String

    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    region String

    The region this subnetwork has been created in. If unspecified, this defaults to the region configured in the provider.

    selfLink String

    The self link of the subnetwork. If self_link is specified, name, project, and region are ignored.

    getSubnetwork Result

    The following output properties are available:

    Description string

    Description of this subnetwork.

    GatewayAddress string

    The IP address of the gateway.

    Id string

    The provider-assigned unique ID for this managed resource.

    InternalIpv6Prefix string

    The internal IPv6 address range that is assigned to this subnetwork.

    IpCidrRange string

    The range of IP addresses belonging to this subnetwork secondary range.

    Network string

    The network name or resource link to the parent network of this subnetwork.

    PrivateIpGoogleAccess bool

    Whether the VMs in this subnet can access Google services without assigned external IP addresses.

    Project string
    Region string
    SecondaryIpRanges List<GetSubnetworkSecondaryIpRange>

    An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. Structure is documented below.

    SelfLink string
    Name string
    Description string

    Description of this subnetwork.

    GatewayAddress string

    The IP address of the gateway.

    Id string

    The provider-assigned unique ID for this managed resource.

    InternalIpv6Prefix string

    The internal IPv6 address range that is assigned to this subnetwork.

    IpCidrRange string

    The range of IP addresses belonging to this subnetwork secondary range.

    Network string

    The network name or resource link to the parent network of this subnetwork.

    PrivateIpGoogleAccess bool

    Whether the VMs in this subnet can access Google services without assigned external IP addresses.

    Project string
    Region string
    SecondaryIpRanges []GetSubnetworkSecondaryIpRange

    An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. Structure is documented below.

    SelfLink string
    Name string
    description String

    Description of this subnetwork.

    gatewayAddress String

    The IP address of the gateway.

    id String

    The provider-assigned unique ID for this managed resource.

    internalIpv6Prefix String

    The internal IPv6 address range that is assigned to this subnetwork.

    ipCidrRange String

    The range of IP addresses belonging to this subnetwork secondary range.

    network String

    The network name or resource link to the parent network of this subnetwork.

    privateIpGoogleAccess Boolean

    Whether the VMs in this subnet can access Google services without assigned external IP addresses.

    project String
    region String
    secondaryIpRanges List<GetSubnetworkSecondaryIpRange>

    An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. Structure is documented below.

    selfLink String
    name String
    description string

    Description of this subnetwork.

    gatewayAddress string

    The IP address of the gateway.

    id string

    The provider-assigned unique ID for this managed resource.

    internalIpv6Prefix string

    The internal IPv6 address range that is assigned to this subnetwork.

    ipCidrRange string

    The range of IP addresses belonging to this subnetwork secondary range.

    network string

    The network name or resource link to the parent network of this subnetwork.

    privateIpGoogleAccess boolean

    Whether the VMs in this subnet can access Google services without assigned external IP addresses.

    project string
    region string
    secondaryIpRanges GetSubnetworkSecondaryIpRange[]

    An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. Structure is documented below.

    selfLink string
    name string
    description str

    Description of this subnetwork.

    gateway_address str

    The IP address of the gateway.

    id str

    The provider-assigned unique ID for this managed resource.

    internal_ipv6_prefix str

    The internal IPv6 address range that is assigned to this subnetwork.

    ip_cidr_range str

    The range of IP addresses belonging to this subnetwork secondary range.

    network str

    The network name or resource link to the parent network of this subnetwork.

    private_ip_google_access bool

    Whether the VMs in this subnet can access Google services without assigned external IP addresses.

    project str
    region str
    secondary_ip_ranges Sequence[GetSubnetworkSecondaryIpRange]

    An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. Structure is documented below.

    self_link str
    name str
    description String

    Description of this subnetwork.

    gatewayAddress String

    The IP address of the gateway.

    id String

    The provider-assigned unique ID for this managed resource.

    internalIpv6Prefix String

    The internal IPv6 address range that is assigned to this subnetwork.

    ipCidrRange String

    The range of IP addresses belonging to this subnetwork secondary range.

    network String

    The network name or resource link to the parent network of this subnetwork.

    privateIpGoogleAccess Boolean

    Whether the VMs in this subnet can access Google services without assigned external IP addresses.

    project String
    region String
    secondaryIpRanges List<Property Map>

    An array of configurations for secondary IP ranges for VM instances contained in this subnetwork. Structure is documented below.

    selfLink String
    name String

    Supporting Types

    GetSubnetworkSecondaryIpRange

    IpCidrRange string

    The range of IP addresses belonging to this subnetwork secondary range.

    RangeName string

    The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.

    IpCidrRange string

    The range of IP addresses belonging to this subnetwork secondary range.

    RangeName string

    The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.

    ipCidrRange String

    The range of IP addresses belonging to this subnetwork secondary range.

    rangeName String

    The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.

    ipCidrRange string

    The range of IP addresses belonging to this subnetwork secondary range.

    rangeName string

    The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.

    ip_cidr_range str

    The range of IP addresses belonging to this subnetwork secondary range.

    range_name str

    The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.

    ipCidrRange String

    The range of IP addresses belonging to this subnetwork secondary range.

    rangeName String

    The name associated with this subnetwork secondary range, used when adding an alias IP range to a VM instance.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the google-beta Terraform Provider.

    gcp logo
    Google Cloud Classic v7.2.2 published on Monday, Jan 1, 0001 by Pulumi