1. Packages
  2. Packages
  3. Juju Provider
  4. API Docs
  5. getSubnets
Viewing docs for juju 2.2.0-rc1
published on Tuesday, Jul 21, 2026 by juju
Viewing docs for juju 2.2.0-rc1
published on Tuesday, Jul 21, 2026 by juju

    A data source representing a list of Juju subnets.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as juju from "@pulumi/juju";
    
    const myModel = juju.getModel({
        name: "default",
    });
    const _this = myModel.then(myModel => juju.getSubnets({
        modelUuid: myModel.uuid,
        spaceName: "alpha",
    }));
    
    import pulumi
    import pulumi_juju as juju
    
    my_model = juju.get_model(name="default")
    this = juju.get_subnets(model_uuid=my_model.uuid,
        space_name="alpha")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/juju/v2/juju"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		myModel, err := juju.LookupModel(ctx, &juju.LookupModelArgs{
    			Name: pulumi.StringRef("default"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = juju.GetSubnets(ctx, &juju.GetSubnetsArgs{
    			ModelUuid: myModel.Uuid,
    			SpaceName: pulumi.StringRef("alpha"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Juju = Pulumi.Juju;
    
    return await Deployment.RunAsync(() => 
    {
        var myModel = Juju.GetModel.Invoke(new()
        {
            Name = "default",
        });
    
        var @this = Juju.GetSubnets.Invoke(new()
        {
            ModelUuid = myModel.Apply(getModelResult => getModelResult.Uuid),
            SpaceName = "alpha",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.juju.JujuFunctions;
    import com.pulumi.juju.inputs.GetModelArgs;
    import com.pulumi.juju.inputs.GetSubnetsArgs;
    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 myModel = JujuFunctions.getModel(GetModelArgs.builder()
                .name("default")
                .build());
    
            final var this = JujuFunctions.getSubnets(GetSubnetsArgs.builder()
                .modelUuid(myModel.uuid())
                .spaceName("alpha")
                .build());
    
        }
    }
    
    variables:
      myModel:
        fn::invoke:
          function: juju:getModel
          arguments:
            name: default
      this:
        fn::invoke:
          function: juju:getSubnets
          arguments:
            modelUuid: ${myModel.uuid}
            spaceName: alpha
    
    Example coming soon!
    

    Using getSubnets

    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 getSubnets(args: GetSubnetsArgs, opts?: InvokeOptions): Promise<GetSubnetsResult>
    function getSubnetsOutput(args: GetSubnetsOutputArgs, opts?: InvokeOptions): Output<GetSubnetsResult>
    def get_subnets(model_uuid: Optional[str] = None,
                    space_name: Optional[str] = None,
                    zone_name: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetSubnetsResult
    def get_subnets_output(model_uuid: pulumi.Input[Optional[str]] = None,
                    space_name: pulumi.Input[Optional[str]] = None,
                    zone_name: pulumi.Input[Optional[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetSubnetsResult]
    func GetSubnets(ctx *Context, args *GetSubnetsArgs, opts ...InvokeOption) (*GetSubnetsResult, error)
    func GetSubnetsOutput(ctx *Context, args *GetSubnetsOutputArgs, opts ...InvokeOption) GetSubnetsResultOutput

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

    public static class GetSubnets 
    {
        public static Task<GetSubnetsResult> InvokeAsync(GetSubnetsArgs args, InvokeOptions? opts = null)
        public static Output<GetSubnetsResult> Invoke(GetSubnetsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSubnetsResult> getSubnets(GetSubnetsArgs args, InvokeOptions options)
    public static Output<GetSubnetsResult> getSubnets(GetSubnetsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: juju:index/getSubnets:getSubnets
      arguments:
        # arguments dictionary
    data "juju_get_subnets" "name" {
        # arguments
    }

    The following arguments are supported:

    ModelUuid string
    The UUID of the model where subnets exist.
    SpaceName string
    Optional space name filter.
    ZoneName string
    Optional availability zone filter.
    ModelUuid string
    The UUID of the model where subnets exist.
    SpaceName string
    Optional space name filter.
    ZoneName string
    Optional availability zone filter.
    model_uuid string
    The UUID of the model where subnets exist.
    space_name string
    Optional space name filter.
    zone_name string
    Optional availability zone filter.
    modelUuid String
    The UUID of the model where subnets exist.
    spaceName String
    Optional space name filter.
    zoneName String
    Optional availability zone filter.
    modelUuid string
    The UUID of the model where subnets exist.
    spaceName string
    Optional space name filter.
    zoneName string
    Optional availability zone filter.
    model_uuid str
    The UUID of the model where subnets exist.
    space_name str
    Optional space name filter.
    zone_name str
    Optional availability zone filter.
    modelUuid String
    The UUID of the model where subnets exist.
    spaceName String
    Optional space name filter.
    zoneName String
    Optional availability zone filter.

    getSubnets Result

    The following output properties are available:

    Id string
    Identifier of the subnets data source.
    ModelUuid string
    The UUID of the model where subnets exist.
    Subnets Dictionary<string, GetSubnetsSubnets>
    Map of subnets keyed by CIDR.
    SpaceName string
    Optional space name filter.
    ZoneName string
    Optional availability zone filter.
    Id string
    Identifier of the subnets data source.
    ModelUuid string
    The UUID of the model where subnets exist.
    Subnets map[string]GetSubnetsSubnets
    Map of subnets keyed by CIDR.
    SpaceName string
    Optional space name filter.
    ZoneName string
    Optional availability zone filter.
    id string
    Identifier of the subnets data source.
    model_uuid string
    The UUID of the model where subnets exist.
    subnets map(object)
    Map of subnets keyed by CIDR.
    space_name string
    Optional space name filter.
    zone_name string
    Optional availability zone filter.
    id String
    Identifier of the subnets data source.
    modelUuid String
    The UUID of the model where subnets exist.
    subnets Map<String,GetSubnetsSubnets>
    Map of subnets keyed by CIDR.
    spaceName String
    Optional space name filter.
    zoneName String
    Optional availability zone filter.
    id string
    Identifier of the subnets data source.
    modelUuid string
    The UUID of the model where subnets exist.
    subnets {[key: string]: GetSubnetsSubnets}
    Map of subnets keyed by CIDR.
    spaceName string
    Optional space name filter.
    zoneName string
    Optional availability zone filter.
    id str
    Identifier of the subnets data source.
    model_uuid str
    The UUID of the model where subnets exist.
    subnets Mapping[str, GetSubnetsSubnets]
    Map of subnets keyed by CIDR.
    space_name str
    Optional space name filter.
    zone_name str
    Optional availability zone filter.
    id String
    Identifier of the subnets data source.
    modelUuid String
    The UUID of the model where subnets exist.
    subnets Map<Property Map>
    Map of subnets keyed by CIDR.
    spaceName String
    Optional space name filter.
    zoneName String
    Optional availability zone filter.

    Supporting Types

    GetSubnetsSubnets

    Cidr string
    Life string
    ProviderId string
    ProviderNetworkId string
    ProviderSpaceId string
    SpaceName string
    VlanTag double
    Zones List<string>
    Cidr string
    Life string
    ProviderId string
    ProviderNetworkId string
    ProviderSpaceId string
    SpaceName string
    VlanTag float64
    Zones []string
    cidr string
    life string
    provider_id string
    provider_network_id string
    provider_space_id string
    space_name string
    vlan_tag number
    zones list(string)
    cidr String
    life String
    providerId String
    providerNetworkId String
    providerSpaceId String
    spaceName String
    vlanTag Double
    zones List<String>
    cidr string
    life string
    providerId string
    providerNetworkId string
    providerSpaceId string
    spaceName string
    vlanTag number
    zones string[]
    cidr String
    life String
    providerId String
    providerNetworkId String
    providerSpaceId String
    spaceName String
    vlanTag Number
    zones List<String>

    Package Details

    Repository
    juju juju/terraform-provider-juju
    License
    Notes
    This Pulumi package is based on the juju Terraform Provider.
    Viewing docs for juju 2.2.0-rc1
    published on Tuesday, Jul 21, 2026 by juju

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial