1. Packages
  2. Packages
  3. Juju Provider
  4. API Docs
  5. getSpace
Viewing docs for juju 2.2.1
published on Monday, Jul 27, 2026 by juju
Viewing docs for juju 2.2.1
published on Monday, Jul 27, 2026 by juju

    A data source representing a Juju space.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as juju from "@pulumi/juju";
    
    const myModel = juju.getModel({
        name: "default",
    });
    const mySpaceDataSource = myModel.then(myModel => juju.getSpace({
        modelUuid: myModel.uuid,
        name: "my-space",
    }));
    
    import pulumi
    import pulumi_juju as juju
    
    my_model = juju.get_model(name="default")
    my_space_data_source = juju.get_space(model_uuid=my_model.uuid,
        name="my-space")
    
    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.LookupSpace(ctx, &juju.LookupSpaceArgs{
    			ModelUuid: myModel.Uuid,
    			Name:      "my-space",
    		}, 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 mySpaceDataSource = Juju.GetSpace.Invoke(new()
        {
            ModelUuid = myModel.Apply(getModelResult => getModelResult.Uuid),
            Name = "my-space",
        });
    
    });
    
    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.GetSpaceArgs;
    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 mySpaceDataSource = JujuFunctions.getSpace(GetSpaceArgs.builder()
                .modelUuid(myModel.uuid())
                .name("my-space")
                .build());
    
        }
    }
    
    variables:
      myModel:
        fn::invoke:
          function: juju:getModel
          arguments:
            name: default
      mySpaceDataSource:
        fn::invoke:
          function: juju:getSpace
          arguments:
            modelUuid: ${myModel.uuid}
            name: my-space
    
    Example coming soon!
    

    Using getSpace

    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 getSpace(args: GetSpaceArgs, opts?: InvokeOptions): Promise<GetSpaceResult>
    function getSpaceOutput(args: GetSpaceOutputArgs, opts?: InvokeOptions): Output<GetSpaceResult>
    def get_space(model_uuid: Optional[str] = None,
                  name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetSpaceResult
    def get_space_output(model_uuid: pulumi.Input[Optional[str]] = None,
                  name: pulumi.Input[Optional[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetSpaceResult]
    func LookupSpace(ctx *Context, args *LookupSpaceArgs, opts ...InvokeOption) (*LookupSpaceResult, error)
    func LookupSpaceOutput(ctx *Context, args *LookupSpaceOutputArgs, opts ...InvokeOption) LookupSpaceResultOutput

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

    public static class GetSpace 
    {
        public static Task<GetSpaceResult> InvokeAsync(GetSpaceArgs args, InvokeOptions? opts = null)
        public static Output<GetSpaceResult> Invoke(GetSpaceInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSpaceResult> getSpace(GetSpaceArgs args, InvokeOptions options)
    public static Output<GetSpaceResult> getSpace(GetSpaceArgs args, InvokeOptions options)
    
    fn::invoke:
      function: juju:index/getSpace:getSpace
      arguments:
        # arguments dictionary
    data "juju_get_space" "name" {
        # arguments
    }

    The following arguments are supported:

    ModelUuid string
    The UUID of the model where the space exists.
    Name string
    The name of the space.
    ModelUuid string
    The UUID of the model where the space exists.
    Name string
    The name of the space.
    model_uuid string
    The UUID of the model where the space exists.
    name string
    The name of the space.
    modelUuid String
    The UUID of the model where the space exists.
    name String
    The name of the space.
    modelUuid string
    The UUID of the model where the space exists.
    name string
    The name of the space.
    model_uuid str
    The UUID of the model where the space exists.
    name str
    The name of the space.
    modelUuid String
    The UUID of the model where the space exists.
    name String
    The name of the space.

    getSpace Result

    The following output properties are available:

    Id string
    The identifier of the space data source. Format: \n\n:\n\n
    ModelUuid string
    The UUID of the model where the space exists.
    Name string
    The name of the space.
    Id string
    The identifier of the space data source. Format: \n\n:\n\n
    ModelUuid string
    The UUID of the model where the space exists.
    Name string
    The name of the space.
    id string
    The identifier of the space data source. Format: \n\n:\n\n
    model_uuid string
    The UUID of the model where the space exists.
    name string
    The name of the space.
    id String
    The identifier of the space data source. Format: \n\n:\n\n
    modelUuid String
    The UUID of the model where the space exists.
    name String
    The name of the space.
    id string
    The identifier of the space data source. Format: \n\n:\n\n
    modelUuid string
    The UUID of the model where the space exists.
    name string
    The name of the space.
    id str
    The identifier of the space data source. Format: \n\n:\n\n
    model_uuid str
    The UUID of the model where the space exists.
    name str
    The name of the space.
    id String
    The identifier of the space data source. Format: \n\n:\n\n
    modelUuid String
    The UUID of the model where the space exists.
    name String
    The name of the space.

    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.1
    published on Monday, Jul 27, 2026 by juju

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial