1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. networksecurity
  5. getAddressGroups
Viewing docs for Google Cloud v9.20.0
published on Wednesday, Apr 15, 2026 by Pulumi
gcp logo
Viewing docs for Google Cloud v9.20.0
published on Wednesday, Apr 15, 2026 by Pulumi

    AddressGroups are used to group IP addresses together for use in firewall policies. This data source allows you to list address groups in a project and location.

    To get more information about Address Groups, see:

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const all = gcp.networksecurity.getAddressGroups({
        location: "us-central1",
        project: "my-project-id",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    all = gcp.networksecurity.get_address_groups(location="us-central1",
        project="my-project-id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/networksecurity"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := networksecurity.GetAddressGroups(ctx, &networksecurity.GetAddressGroupsArgs{
    			Location: "us-central1",
    			Project:  pulumi.StringRef("my-project-id"),
    		}, 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 all = Gcp.NetworkSecurity.GetAddressGroups.Invoke(new()
        {
            Location = "us-central1",
            Project = "my-project-id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.networksecurity.NetworksecurityFunctions;
    import com.pulumi.gcp.networksecurity.inputs.GetAddressGroupsArgs;
    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 all = NetworksecurityFunctions.getAddressGroups(GetAddressGroupsArgs.builder()
                .location("us-central1")
                .project("my-project-id")
                .build());
    
        }
    }
    
    variables:
      all:
        fn::invoke:
          function: gcp:networksecurity:getAddressGroups
          arguments:
            location: us-central1
            project: my-project-id
    

    Using getAddressGroups

    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 getAddressGroups(args: GetAddressGroupsArgs, opts?: InvokeOptions): Promise<GetAddressGroupsResult>
    function getAddressGroupsOutput(args: GetAddressGroupsOutputArgs, opts?: InvokeOptions): Output<GetAddressGroupsResult>
    def get_address_groups(location: Optional[str] = None,
                           project: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetAddressGroupsResult
    def get_address_groups_output(location: Optional[pulumi.Input[str]] = None,
                           project: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetAddressGroupsResult]
    func GetAddressGroups(ctx *Context, args *GetAddressGroupsArgs, opts ...InvokeOption) (*GetAddressGroupsResult, error)
    func GetAddressGroupsOutput(ctx *Context, args *GetAddressGroupsOutputArgs, opts ...InvokeOption) GetAddressGroupsResultOutput

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

    public static class GetAddressGroups 
    {
        public static Task<GetAddressGroupsResult> InvokeAsync(GetAddressGroupsArgs args, InvokeOptions? opts = null)
        public static Output<GetAddressGroupsResult> Invoke(GetAddressGroupsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAddressGroupsResult> getAddressGroups(GetAddressGroupsArgs args, InvokeOptions options)
    public static Output<GetAddressGroupsResult> getAddressGroups(GetAddressGroupsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:networksecurity/getAddressGroups:getAddressGroups
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Location string
    The location of the Address Group.
    Project string
    The ID of the project.
    Location string
    The location of the Address Group.
    Project string
    The ID of the project.
    location String
    The location of the Address Group.
    project String
    The ID of the project.
    location string
    The location of the Address Group.
    project string
    The ID of the project.
    location str
    The location of the Address Group.
    project str
    The ID of the project.
    location String
    The location of the Address Group.
    project String
    The ID of the project.

    getAddressGroups Result

    The following output properties are available:

    AddressGroups List<GetAddressGroupsAddressGroup>
    A list of Address Groups in the selected project and location. Structure is defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Project string
    The ID of the project in which the resource belongs.
    AddressGroups []GetAddressGroupsAddressGroup
    A list of Address Groups in the selected project and location. Structure is defined below.
    Id string
    The provider-assigned unique ID for this managed resource.
    Location string
    Project string
    The ID of the project in which the resource belongs.
    addressGroups List<GetAddressGroupsAddressGroup>
    A list of Address Groups in the selected project and location. Structure is defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    project String
    The ID of the project in which the resource belongs.
    addressGroups GetAddressGroupsAddressGroup[]
    A list of Address Groups in the selected project and location. Structure is defined below.
    id string
    The provider-assigned unique ID for this managed resource.
    location string
    project string
    The ID of the project in which the resource belongs.
    address_groups Sequence[GetAddressGroupsAddressGroup]
    A list of Address Groups in the selected project and location. Structure is defined below.
    id str
    The provider-assigned unique ID for this managed resource.
    location str
    project str
    The ID of the project in which the resource belongs.
    addressGroups List<Property Map>
    A list of Address Groups in the selected project and location. Structure is defined below.
    id String
    The provider-assigned unique ID for this managed resource.
    location String
    project String
    The ID of the project in which the resource belongs.

    Supporting Types

    GetAddressGroupsAddressGroup

    Capacity int
    Items List<string>
    Location string
    The location of the Address Group.
    Name string
    The name of the Address Group.
    Capacity int
    Items []string
    Location string
    The location of the Address Group.
    Name string
    The name of the Address Group.
    capacity Integer
    items List<String>
    location String
    The location of the Address Group.
    name String
    The name of the Address Group.
    capacity number
    items string[]
    location string
    The location of the Address Group.
    name string
    The name of the Address Group.
    capacity int
    items Sequence[str]
    location str
    The location of the Address Group.
    name str
    The name of the Address Group.
    capacity Number
    items List<String>
    location String
    The location of the Address Group.
    name String
    The name of the Address Group.

    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
    Viewing docs for Google Cloud v9.20.0
    published on Wednesday, Apr 15, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.