1. Packages
  2. Juju Provider
  3. API Docs
  4. getMachine
juju 0.18.0 published on Monday, Apr 14, 2025 by juju

juju.getMachine

Explore with Pulumi AI

juju 0.18.0 published on Monday, Apr 14, 2025 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({
    model: juju_model.development.name,
    machineId: "2",
});
Copy
import pulumi
import pulumi_juju as juju

this = juju.get_machine(model=juju_model["development"]["name"],
    machine_id="2")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/juju/juju"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := juju.LookupMachine(ctx, &juju.LookupMachineArgs{
			Model:     juju_model.Development.Name,
			MachineId: "2",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Juju = Pulumi.Juju;

return await Deployment.RunAsync(() => 
{
    var @this = Juju.GetMachine.Invoke(new()
    {
        Model = juju_model.Development.Name,
        MachineId = "2",
    });

});
Copy
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()
            .model(juju_model.development().name())
            .machineId("2")
            .build());

    }
}
Copy
variables:
  this:
    fn::invoke:
      function: juju:getMachine
      arguments:
        model: ${juju_model.development.name}
        machineId: '2'
Copy

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?: InvokeOptions): Output<GetMachineResult>
Copy
def get_machine(machine_id: Optional[str] = None,
                model: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetMachineResult
def get_machine_output(machine_id: Optional[pulumi.Input[str]] = None,
                model: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetMachineResult]
Copy
func LookupMachine(ctx *Context, args *LookupMachineArgs, opts ...InvokeOption) (*LookupMachineResult, error)
func LookupMachineOutput(ctx *Context, args *LookupMachineOutputArgs, opts ...InvokeOption) LookupMachineResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetMachineResult> getMachine(GetMachineArgs args, InvokeOptions options)
public static Output<GetMachineResult> getMachine(GetMachineArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: juju:index/getMachine:getMachine
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

MachineId This property is required. string
The Juju id of the machine.
Model This property is required. string
The name of the model.
MachineId This property is required. string
The Juju id of the machine.
Model This property is required. string
The name of the model.
machineId This property is required. String
The Juju id of the machine.
model This property is required. String
The name of the model.
machineId This property is required. string
The Juju id of the machine.
model This property is required. string
The name of the model.
machine_id This property is required. str
The Juju id of the machine.
model This property is required. str
The name of the model.
machineId This property is required. String
The Juju id of the machine.
model This property is required. String
The name of the model.

getMachine Result

The following output properties are available:

Id string
The ID of this resource.
MachineId string
The Juju id of the machine.
Model string
The name of the model.
Id string
The ID of this resource.
MachineId string
The Juju id of the machine.
Model string
The name of the model.
id String
The ID of this resource.
machineId String
The Juju id of the machine.
model String
The name of the model.
id string
The ID of this resource.
machineId string
The Juju id of the machine.
model string
The name of the model.
id str
The ID of this resource.
machine_id str
The Juju id of the machine.
model str
The name of the model.
id String
The ID of this resource.
machineId String
The Juju id of the machine.
model String
The name of the model.

Package Details

Repository
juju juju/terraform-provider-juju
License
Notes
This Pulumi package is based on the juju Terraform Provider.
juju 0.18.0 published on Monday, Apr 14, 2025 by juju