1. Registry
  2. Packages
  3. Juju Provider
  4. API Docs
  5. getMachine
Viewing docs for juju 2.4.1
published on Thursday, Oct 8, 2026 by juju
juju
Viewing docs for juju 2.4.1
published on Thursday, Oct 8, 2026 by juju

    A data source representing a Juju Machine.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as juju from "@pulumi/juju";
    
    const _this = juju.getMachine({
        modelUuid: development.uuid,
        machineId: "2",
    });
    
    import pulumi
    import pulumi_juju as juju
    
    this = juju.get_machine(model_uuid=development["uuid"],
        machine_id="2")
    
    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 {
    		_, err := juju.LookupMachine(ctx, &juju.LookupMachineArgs{
    			ModelUuid: development.Uuid,
    			MachineId: "2",
    		}, 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 @this = Juju.GetMachine.Invoke(new()
        {
            ModelUuid = development.Uuid,
            MachineId = "2",
        });
    
    });
    
    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.GetMachineArgs;
    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 this = JujuFunctions.getMachine(GetMachineArgs.builder()
                .modelUuid(development.uuid())
                .machineId("2")
                .build());
    
        }
    }
    
    variables:
      this:
        fn::invoke:
          function: juju:getMachine
          arguments:
            modelUuid: ${development.uuid}
            machineId: '2'
    
    Example coming soon!
    

    Using getMachine

    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 getMachine(args: GetMachineArgs, opts?: InvokeOptions): Promise<GetMachineResult>
    function getMachineOutput(args: GetMachineOutputArgs, opts?: InvokeOutputOptions): Output<GetMachineResult>
    def get_machine(machine_id: Optional[str] = None,
                    model_uuid: Optional[str] = None,
                    wait_for_ip_addresses: Optional[Sequence[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> GetMachineResult
    def get_machine_output(machine_id: pulumi.Input[Optional[str]] = None,
                    model_uuid: pulumi.Input[Optional[str]] = None,
                    wait_for_ip_addresses: pulumi.Input[Optional[Sequence[pulumi.Input[str]]]] = None,
                    opts: Optional[InvokeOutputOptions] = None) -> Output[GetMachineResult]
    func LookupMachine(ctx *Context, args *LookupMachineArgs, opts ...InvokeOption) (*LookupMachineResult, error)
    func LookupMachineOutput(ctx *Context, args *LookupMachineOutputArgs, opts ...InvokeOption) LookupMachineResultOutput

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

    public static class GetMachine 
    {
        public static Task<GetMachineResult> InvokeAsync(GetMachineArgs args, InvokeOptions? opts = null)
        public static Output<GetMachineResult> Invoke(GetMachineInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetMachineResult> Invoke(GetMachineInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetMachineResult> getMachine(GetMachineArgs args, InvokeOptions options)
    public static Output<GetMachineResult> getMachine(GetMachineArgs args, InvokeOptions options)
    public static Output<GetMachineResult> getMachine(GetMachineArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: juju:index/getMachine:getMachine
      arguments:
        # arguments dictionary
    data "juju_get_machine" "name" {
        # arguments
    }

    The following arguments are supported:

    MachineId string
    The Juju id of the machine.
    ModelUuid string
    The UUID of the model.
    WaitForIpAddresses List<string>
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    MachineId string
    The Juju id of the machine.
    ModelUuid string
    The UUID of the model.
    WaitForIpAddresses []string
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    machine_id string
    The Juju id of the machine.
    model_uuid string
    The UUID of the model.
    wait_for_ip_addresses list(string)
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    machineId String
    The Juju id of the machine.
    modelUuid String
    The UUID of the model.
    waitForIpAddresses List<String>
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    machineId string
    The Juju id of the machine.
    modelUuid string
    The UUID of the model.
    waitForIpAddresses string[]
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    machine_id str
    The Juju id of the machine.
    model_uuid str
    The UUID of the model.
    wait_for_ip_addresses Sequence[str]
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    machineId String
    The Juju id of the machine.
    modelUuid String
    The UUID of the model.
    waitForIpAddresses List<String>
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.

    getMachine Result

    The following output properties are available:

    Id string
    The ID of this resource.
    InstanceId string
    The provider-specific instance id of the machine Juju creates.
    IpAddresses List<string>
    If wait_for_ip_addresses is set it will contain the IP addresses of the machine matching the 'waitforip_addresses' conditions, in the same order. If not set this field will contain the IPs fetched when the machine is read.
    MachineId string
    The Juju id of the machine.
    ModelUuid string
    The UUID of the model.
    WaitForIpAddresses List<string>
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    Id string
    The ID of this resource.
    InstanceId string
    The provider-specific instance id of the machine Juju creates.
    IpAddresses []string
    If wait_for_ip_addresses is set it will contain the IP addresses of the machine matching the 'waitforip_addresses' conditions, in the same order. If not set this field will contain the IPs fetched when the machine is read.
    MachineId string
    The Juju id of the machine.
    ModelUuid string
    The UUID of the model.
    WaitForIpAddresses []string
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    id string
    The ID of this resource.
    instance_id string
    The provider-specific instance id of the machine Juju creates.
    ip_addresses list(string)
    If wait_for_ip_addresses is set it will contain the IP addresses of the machine matching the 'waitforip_addresses' conditions, in the same order. If not set this field will contain the IPs fetched when the machine is read.
    machine_id string
    The Juju id of the machine.
    model_uuid string
    The UUID of the model.
    wait_for_ip_addresses list(string)
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    id String
    The ID of this resource.
    instanceId String
    The provider-specific instance id of the machine Juju creates.
    ipAddresses List<String>
    If wait_for_ip_addresses is set it will contain the IP addresses of the machine matching the 'waitforip_addresses' conditions, in the same order. If not set this field will contain the IPs fetched when the machine is read.
    machineId String
    The Juju id of the machine.
    modelUuid String
    The UUID of the model.
    waitForIpAddresses List<String>
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    id string
    The ID of this resource.
    instanceId string
    The provider-specific instance id of the machine Juju creates.
    ipAddresses string[]
    If wait_for_ip_addresses is set it will contain the IP addresses of the machine matching the 'waitforip_addresses' conditions, in the same order. If not set this field will contain the IPs fetched when the machine is read.
    machineId string
    The Juju id of the machine.
    modelUuid string
    The UUID of the model.
    waitForIpAddresses string[]
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    id str
    The ID of this resource.
    instance_id str
    The provider-specific instance id of the machine Juju creates.
    ip_addresses Sequence[str]
    If wait_for_ip_addresses is set it will contain the IP addresses of the machine matching the 'waitforip_addresses' conditions, in the same order. If not set this field will contain the IPs fetched when the machine is read.
    machine_id str
    The Juju id of the machine.
    model_uuid str
    The UUID of the model.
    wait_for_ip_addresses Sequence[str]
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.
    id String
    The ID of this resource.
    instanceId String
    The provider-specific instance id of the machine Juju creates.
    ipAddresses List<String>
    If wait_for_ip_addresses is set it will contain the IP addresses of the machine matching the 'waitforip_addresses' conditions, in the same order. If not set this field will contain the IPs fetched when the machine is read.
    machineId String
    The Juju id of the machine.
    modelUuid String
    The UUID of the model.
    waitForIpAddresses List<String>
    A list of IP address conditions the provider waits for before completing the read. Each element must be one of: a CIDR (e.g. "10.0.10.0/24"), or the aliases "public", "private", "any". The matching IP addresses are populated in the 'ip_addresses' computed field, in the same order as this list. Conditions are evaluated from left to right, so put narrow CIDRs first, followed by broader CIDRs or "public"/"private", and "any" last.

    Package Details

    Repository
    juju juju/terraform-provider-juju
    License
    Notes
    This Pulumi package is based on the juju Terraform Provider.
    juju
    Viewing docs for juju 2.4.1
    published on Thursday, Oct 8, 2026 by juju

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial