1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getSubnetworks
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.compute.getSubnetworks

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    Get subnetworks within GCE. See the official documentation and API.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const my-subnetworks = gcp.compute.getSubnetworks({
        filter: "ipCidrRange eq 192.168.178.0/24",
        project: "my-project",
        region: "us-east1",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    my_subnetworks = gcp.compute.get_subnetworks(filter="ipCidrRange eq 192.168.178.0/24",
        project="my-project",
        region="us-east1")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.GetSubnetworks(ctx, &compute.GetSubnetworksArgs{
    			Filter:  pulumi.StringRef("ipCidrRange eq 192.168.178.0/24"),
    			Project: pulumi.StringRef("my-project"),
    			Region:  pulumi.StringRef("us-east1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var my_subnetworks = Gcp.Compute.GetSubnetworks.Invoke(new()
        {
            Filter = "ipCidrRange eq 192.168.178.0/24",
            Project = "my-project",
            Region = "us-east1",
        });
    
    });
    
    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.GetSubnetworksArgs;
    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-subnetworks = ComputeFunctions.getSubnetworks(GetSubnetworksArgs.builder()
                .filter("ipCidrRange eq 192.168.178.0/24")
                .project("my-project")
                .region("us-east1")
                .build());
    
        }
    }
    
    variables:
      my-subnetworks:
        fn::invoke:
          Function: gcp:compute:getSubnetworks
          Arguments:
            filter: ipCidrRange eq 192.168.178.0/24
            project: my-project
            region: us-east1
    

    Using getSubnetworks

    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 getSubnetworks(args: GetSubnetworksArgs, opts?: InvokeOptions): Promise<GetSubnetworksResult>
    function getSubnetworksOutput(args: GetSubnetworksOutputArgs, opts?: InvokeOptions): Output<GetSubnetworksResult>
    def get_subnetworks(filter: Optional[str] = None,
                        project: Optional[str] = None,
                        region: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetSubnetworksResult
    def get_subnetworks_output(filter: Optional[pulumi.Input[str]] = None,
                        project: Optional[pulumi.Input[str]] = None,
                        region: Optional[pulumi.Input[str]] = None,
                        opts: Optional[InvokeOptions] = None) -> Output[GetSubnetworksResult]
    func GetSubnetworks(ctx *Context, args *GetSubnetworksArgs, opts ...InvokeOption) (*GetSubnetworksResult, error)
    func GetSubnetworksOutput(ctx *Context, args *GetSubnetworksOutputArgs, opts ...InvokeOption) GetSubnetworksResultOutput

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

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

    The following arguments are supported:

    Filter string
    A string filter as defined in the REST API.
    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.
    Filter string
    A string filter as defined in the REST API.
    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.
    filter String
    A string filter as defined in the REST API.
    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.
    filter string
    A string filter as defined in the REST API.
    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.
    filter str
    A string filter as defined in the REST API.
    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.
    filter String
    A string filter as defined in the REST API.
    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.

    getSubnetworks Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Subnetworks List<GetSubnetworksSubnetwork>
    A list of all retrieved GCE subnetworks. Structure is defined below.
    Filter string
    Project string
    Region string
    Id string
    The provider-assigned unique ID for this managed resource.
    Subnetworks []GetSubnetworksSubnetwork
    A list of all retrieved GCE subnetworks. Structure is defined below.
    Filter string
    Project string
    Region string
    id String
    The provider-assigned unique ID for this managed resource.
    subnetworks List<GetSubnetworksSubnetwork>
    A list of all retrieved GCE subnetworks. Structure is defined below.
    filter String
    project String
    region String
    id string
    The provider-assigned unique ID for this managed resource.
    subnetworks GetSubnetworksSubnetwork[]
    A list of all retrieved GCE subnetworks. Structure is defined below.
    filter string
    project string
    region string
    id str
    The provider-assigned unique ID for this managed resource.
    subnetworks Sequence[GetSubnetworksSubnetwork]
    A list of all retrieved GCE subnetworks. Structure is defined below.
    filter str
    project str
    region str
    id String
    The provider-assigned unique ID for this managed resource.
    subnetworks List<Property Map>
    A list of all retrieved GCE subnetworks. Structure is defined below.
    filter String
    project String
    region String

    Supporting Types

    GetSubnetworksSubnetwork

    Description string
    Description of the subnetwork.
    IpCidrRange string
    The IP address range represented as a CIDR block.
    Name string
    The name of the subnetwork.
    Network string
    The self link of the parent network.
    NetworkSelfLink string
    PrivateIpGoogleAccess bool
    Whether the VMs in the subnet can access Google services without assigned external IP addresses.
    SelfLink string
    The self link of the subnetwork.
    Description string
    Description of the subnetwork.
    IpCidrRange string
    The IP address range represented as a CIDR block.
    Name string
    The name of the subnetwork.
    Network string
    The self link of the parent network.
    NetworkSelfLink string
    PrivateIpGoogleAccess bool
    Whether the VMs in the subnet can access Google services without assigned external IP addresses.
    SelfLink string
    The self link of the subnetwork.
    description String
    Description of the subnetwork.
    ipCidrRange String
    The IP address range represented as a CIDR block.
    name String
    The name of the subnetwork.
    network String
    The self link of the parent network.
    networkSelfLink String
    privateIpGoogleAccess Boolean
    Whether the VMs in the subnet can access Google services without assigned external IP addresses.
    selfLink String
    The self link of the subnetwork.
    description string
    Description of the subnetwork.
    ipCidrRange string
    The IP address range represented as a CIDR block.
    name string
    The name of the subnetwork.
    network string
    The self link of the parent network.
    networkSelfLink string
    privateIpGoogleAccess boolean
    Whether the VMs in the subnet can access Google services without assigned external IP addresses.
    selfLink string
    The self link of the subnetwork.
    description str
    Description of the subnetwork.
    ip_cidr_range str
    The IP address range represented as a CIDR block.
    name str
    The name of the subnetwork.
    network str
    The self link of the parent network.
    network_self_link str
    private_ip_google_access bool
    Whether the VMs in the subnet can access Google services without assigned external IP addresses.
    self_link str
    The self link of the subnetwork.
    description String
    Description of the subnetwork.
    ipCidrRange String
    The IP address range represented as a CIDR block.
    name String
    The name of the subnetwork.
    network String
    The self link of the parent network.
    networkSelfLink String
    privateIpGoogleAccess Boolean
    Whether the VMs in the subnet can access Google services without assigned external IP addresses.
    selfLink String
    The self link of the subnetwork.

    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 v8.9.3 published on Monday, Nov 18, 2024 by Pulumi