1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getNetworkAttachment
Google Cloud v8.39.0 published on Tuesday, Jul 22, 2025 by Pulumi

gcp.compute.getNetworkAttachment

Explore with Pulumi AI

gcp logo
Google Cloud v8.39.0 published on Tuesday, Jul 22, 2025 by Pulumi

    Get a specific network attachment within a region. For more information see the official documentation and API.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = gcp.compute.getNetworkAttachment({
        project: "my-project",
        name: "my-network-attachment",
        region: "europe-west1",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.get_network_attachment(project="my-project",
        name="my-network-attachment",
        region="europe-west1")
    
    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.LookupNetworkAttachment(ctx, &compute.LookupNetworkAttachmentArgs{
    			Project: pulumi.StringRef("my-project"),
    			Name:    "my-network-attachment",
    			Region:  "europe-west1",
    		}, 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 @default = Gcp.Compute.GetNetworkAttachment.Invoke(new()
        {
            Project = "my-project",
            Name = "my-network-attachment",
            Region = "europe-west1",
        });
    
    });
    
    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.GetNetworkAttachmentArgs;
    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 default = ComputeFunctions.getNetworkAttachment(GetNetworkAttachmentArgs.builder()
                .project("my-project")
                .name("my-network-attachment")
                .region("europe-west1")
                .build());
    
        }
    }
    
    variables:
      default:
        fn::invoke:
          function: gcp:compute:getNetworkAttachment
          arguments:
            project: my-project
            name: my-network-attachment
            region: europe-west1
    

    Using getNetworkAttachment

    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 getNetworkAttachment(args: GetNetworkAttachmentArgs, opts?: InvokeOptions): Promise<GetNetworkAttachmentResult>
    function getNetworkAttachmentOutput(args: GetNetworkAttachmentOutputArgs, opts?: InvokeOptions): Output<GetNetworkAttachmentResult>
    def get_network_attachment(name: Optional[str] = None,
                               project: Optional[str] = None,
                               region: Optional[str] = None,
                               opts: Optional[InvokeOptions] = None) -> GetNetworkAttachmentResult
    def get_network_attachment_output(name: Optional[pulumi.Input[str]] = None,
                               project: Optional[pulumi.Input[str]] = None,
                               region: Optional[pulumi.Input[str]] = None,
                               opts: Optional[InvokeOptions] = None) -> Output[GetNetworkAttachmentResult]
    func LookupNetworkAttachment(ctx *Context, args *LookupNetworkAttachmentArgs, opts ...InvokeOption) (*LookupNetworkAttachmentResult, error)
    func LookupNetworkAttachmentOutput(ctx *Context, args *LookupNetworkAttachmentOutputArgs, opts ...InvokeOption) LookupNetworkAttachmentResultOutput

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

    public static class GetNetworkAttachment 
    {
        public static Task<GetNetworkAttachmentResult> InvokeAsync(GetNetworkAttachmentArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkAttachmentResult> Invoke(GetNetworkAttachmentInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworkAttachmentResult> getNetworkAttachment(GetNetworkAttachmentArgs args, InvokeOptions options)
    public static Output<GetNetworkAttachmentResult> getNetworkAttachment(GetNetworkAttachmentArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:compute/getNetworkAttachment:getNetworkAttachment
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    The name of the network attachment to retrieve. The name must be unique within the region.
    Region string
    The region in which the network attachment resides. For example, europe-west1.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Name string
    The name of the network attachment to retrieve. The name must be unique within the region.
    Region string
    The region in which the network attachment resides. For example, europe-west1.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    name String
    The name of the network attachment to retrieve. The name must be unique within the region.
    region String
    The region in which the network attachment resides. For example, europe-west1.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    name string
    The name of the network attachment to retrieve. The name must be unique within the region.
    region string
    The region in which the network attachment resides. For example, europe-west1.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    name str
    The name of the network attachment to retrieve. The name must be unique within the region.
    region str
    The region in which the network attachment resides. For example, europe-west1.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    name String
    The name of the network attachment to retrieve. The name must be unique within the region.
    region String
    The region in which the network attachment resides. For example, europe-west1.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    getNetworkAttachment Result

    The following output properties are available:

    Supporting Types

    GetNetworkAttachmentConnectionEndpoint

    IpAddress string
    The IPv4 address assigned to the producer instance network interface. This value will be a range in case of Serverless.
    ProjectIdOrNum string
    The project id or number of the interface to which the IP was assigned.
    SecondaryIpCidrRanges string
    Alias IP ranges from the same subnetwork.
    Status string
    The status of a connected endpoint to this network attachment.
    Subnetwork string
    The subnetwork used to assign the IP to the producer instance network interface.
    IpAddress string
    The IPv4 address assigned to the producer instance network interface. This value will be a range in case of Serverless.
    ProjectIdOrNum string
    The project id or number of the interface to which the IP was assigned.
    SecondaryIpCidrRanges string
    Alias IP ranges from the same subnetwork.
    Status string
    The status of a connected endpoint to this network attachment.
    Subnetwork string
    The subnetwork used to assign the IP to the producer instance network interface.
    ipAddress String
    The IPv4 address assigned to the producer instance network interface. This value will be a range in case of Serverless.
    projectIdOrNum String
    The project id or number of the interface to which the IP was assigned.
    secondaryIpCidrRanges String
    Alias IP ranges from the same subnetwork.
    status String
    The status of a connected endpoint to this network attachment.
    subnetwork String
    The subnetwork used to assign the IP to the producer instance network interface.
    ipAddress string
    The IPv4 address assigned to the producer instance network interface. This value will be a range in case of Serverless.
    projectIdOrNum string
    The project id or number of the interface to which the IP was assigned.
    secondaryIpCidrRanges string
    Alias IP ranges from the same subnetwork.
    status string
    The status of a connected endpoint to this network attachment.
    subnetwork string
    The subnetwork used to assign the IP to the producer instance network interface.
    ip_address str
    The IPv4 address assigned to the producer instance network interface. This value will be a range in case of Serverless.
    project_id_or_num str
    The project id or number of the interface to which the IP was assigned.
    secondary_ip_cidr_ranges str
    Alias IP ranges from the same subnetwork.
    status str
    The status of a connected endpoint to this network attachment.
    subnetwork str
    The subnetwork used to assign the IP to the producer instance network interface.
    ipAddress String
    The IPv4 address assigned to the producer instance network interface. This value will be a range in case of Serverless.
    projectIdOrNum String
    The project id or number of the interface to which the IP was assigned.
    secondaryIpCidrRanges String
    Alias IP ranges from the same subnetwork.
    status String
    The status of a connected endpoint to this network attachment.
    subnetwork String
    The subnetwork used to assign the IP to the producer instance network interface.

    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 v8.39.0 published on Tuesday, Jul 22, 2025 by Pulumi