juju.Machine
Explore with Pulumi AI
A resource that represents a Juju machine deployment. Refer to the juju add-machine CLI command for more information and limitations.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as juju from "@pulumi/juju";
const thisMachine = new juju.Machine("thisMachine", {
model: juju_model.development.name,
base: "ubuntu@22.04",
constraints: "tags=my-machine-tag",
});
import pulumi
import pulumi_juju as juju
this_machine = juju.Machine("thisMachine",
model=juju_model["development"]["name"],
base="ubuntu@22.04",
constraints="tags=my-machine-tag")
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.NewMachine(ctx, "thisMachine", &juju.MachineArgs{
Model: pulumi.Any(juju_model.Development.Name),
Base: pulumi.String("ubuntu@22.04"),
Constraints: pulumi.String("tags=my-machine-tag"),
})
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 thisMachine = new Juju.Machine("thisMachine", new()
{
Model = juju_model.Development.Name,
Base = "ubuntu@22.04",
Constraints = "tags=my-machine-tag",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.juju.Machine;
import com.pulumi.juju.MachineArgs;
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) {
var thisMachine = new Machine("thisMachine", MachineArgs.builder()
.model(juju_model.development().name())
.base("ubuntu@22.04")
.constraints("tags=my-machine-tag")
.build());
}
}
resources:
thisMachine:
type: juju:Machine
properties:
model: ${juju_model.development.name}
base: ubuntu@22.04
constraints: tags=my-machine-tag
Create Machine Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Machine(name: string, args: MachineArgs, opts?: CustomResourceOptions);
@overload
def Machine(resource_name: str,
args: MachineArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Machine(resource_name: str,
opts: Optional[ResourceOptions] = None,
model: Optional[str] = None,
base: Optional[str] = None,
constraints: Optional[str] = None,
disks: Optional[str] = None,
name: Optional[str] = None,
placement: Optional[str] = None,
private_key_file: Optional[str] = None,
public_key_file: Optional[str] = None,
series: Optional[str] = None,
ssh_address: Optional[str] = None)
func NewMachine(ctx *Context, name string, args MachineArgs, opts ...ResourceOption) (*Machine, error)
public Machine(string name, MachineArgs args, CustomResourceOptions? opts = null)
public Machine(String name, MachineArgs args)
public Machine(String name, MachineArgs args, CustomResourceOptions options)
type: juju:Machine
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MachineArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MachineArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MachineArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MachineArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MachineArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var machineResource = new Juju.Machine("machineResource", new()
{
Model = "string",
Base = "string",
Constraints = "string",
Disks = "string",
Name = "string",
Placement = "string",
PrivateKeyFile = "string",
PublicKeyFile = "string",
SshAddress = "string",
});
example, err := juju.NewMachine(ctx, "machineResource", &juju.MachineArgs{
Model: pulumi.String("string"),
Base: pulumi.String("string"),
Constraints: pulumi.String("string"),
Disks: pulumi.String("string"),
Name: pulumi.String("string"),
Placement: pulumi.String("string"),
PrivateKeyFile: pulumi.String("string"),
PublicKeyFile: pulumi.String("string"),
SshAddress: pulumi.String("string"),
})
var machineResource = new Machine("machineResource", MachineArgs.builder()
.model("string")
.base("string")
.constraints("string")
.disks("string")
.name("string")
.placement("string")
.privateKeyFile("string")
.publicKeyFile("string")
.sshAddress("string")
.build());
machine_resource = juju.Machine("machineResource",
model="string",
base="string",
constraints="string",
disks="string",
name="string",
placement="string",
private_key_file="string",
public_key_file="string",
ssh_address="string")
const machineResource = new juju.Machine("machineResource", {
model: "string",
base: "string",
constraints: "string",
disks: "string",
name: "string",
placement: "string",
privateKeyFile: "string",
publicKeyFile: "string",
sshAddress: "string",
});
type: juju:Machine
properties:
base: string
constraints: string
disks: string
model: string
name: string
placement: string
privateKeyFile: string
publicKeyFile: string
sshAddress: string
Machine Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Machine resource accepts the following input properties:
- Model string
- Base string
- Constraints string
- Disks string
- Name string
- Placement string
- Private
Key stringFile - The file path to read the private key from.
- Public
Key stringFile - The file path to read the public key from.
- Series string
- Ssh
Address string
- Model string
- Base string
- Constraints string
- Disks string
- Name string
- Placement string
- Private
Key stringFile - The file path to read the private key from.
- Public
Key stringFile - The file path to read the public key from.
- Series string
- Ssh
Address string
- model String
- base String
- constraints String
- disks String
- name String
- placement String
- private
Key StringFile - The file path to read the private key from.
- public
Key StringFile - The file path to read the public key from.
- series String
- ssh
Address String
- model string
- base string
- constraints string
- disks string
- name string
- placement string
- private
Key stringFile - The file path to read the private key from.
- public
Key stringFile - The file path to read the public key from.
- series string
- ssh
Address string
- model str
- base str
- constraints str
- disks str
- name str
- placement str
- private_
key_ strfile - The file path to read the private key from.
- public_
key_ strfile - The file path to read the public key from.
- series str
- ssh_
address str
- model String
- base String
- constraints String
- disks String
- name String
- placement String
- private
Key StringFile - The file path to read the private key from.
- public
Key StringFile - The file path to read the public key from.
- series String
- ssh
Address String
Outputs
All input properties are implicitly available as output properties. Additionally, the Machine resource produces the following output properties:
- id str
- The provider-assigned unique ID for this managed resource.
- machine_
id str - The id of the machine Juju creates.
Look up Existing Machine Resource
Get an existing Machine resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MachineState, opts?: CustomResourceOptions): Machine
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
base: Optional[str] = None,
constraints: Optional[str] = None,
disks: Optional[str] = None,
machine_id: Optional[str] = None,
model: Optional[str] = None,
name: Optional[str] = None,
placement: Optional[str] = None,
private_key_file: Optional[str] = None,
public_key_file: Optional[str] = None,
series: Optional[str] = None,
ssh_address: Optional[str] = None) -> Machine
func GetMachine(ctx *Context, name string, id IDInput, state *MachineState, opts ...ResourceOption) (*Machine, error)
public static Machine Get(string name, Input<string> id, MachineState? state, CustomResourceOptions? opts = null)
public static Machine get(String name, Output<String> id, MachineState state, CustomResourceOptions options)
resources: _: type: juju:Machine get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Base string
- Constraints string
- Disks string
- Machine
Id string - The id of the machine Juju creates.
- Model string
- Name string
- Placement string
- Private
Key stringFile - The file path to read the private key from.
- Public
Key stringFile - The file path to read the public key from.
- Series string
- Ssh
Address string
- Base string
- Constraints string
- Disks string
- Machine
Id string - The id of the machine Juju creates.
- Model string
- Name string
- Placement string
- Private
Key stringFile - The file path to read the private key from.
- Public
Key stringFile - The file path to read the public key from.
- Series string
- Ssh
Address string
- base String
- constraints String
- disks String
- machine
Id String - The id of the machine Juju creates.
- model String
- name String
- placement String
- private
Key StringFile - The file path to read the private key from.
- public
Key StringFile - The file path to read the public key from.
- series String
- ssh
Address String
- base string
- constraints string
- disks string
- machine
Id string - The id of the machine Juju creates.
- model string
- name string
- placement string
- private
Key stringFile - The file path to read the private key from.
- public
Key stringFile - The file path to read the public key from.
- series string
- ssh
Address string
- base str
- constraints str
- disks str
- machine_
id str - The id of the machine Juju creates.
- model str
- name str
- placement str
- private_
key_ strfile - The file path to read the private key from.
- public_
key_ strfile - The file path to read the public key from.
- series str
- ssh_
address str
- base String
- constraints String
- disks String
- machine
Id String - The id of the machine Juju creates.
- model String
- name String
- placement String
- private
Key StringFile - The file path to read the private key from.
- public
Key StringFile - The file path to read the public key from.
- series String
- ssh
Address String
Import
Machines can be imported using the format: model_name:machine_id:machine_name
.
The value of machine_id is the Juju Machine ID. machine_name is an optional
name you can define in Terraform for the machine. It is not used in Juju.
Here is an example to import a machine from the development model with
machine ID 1 and a name “machine_one”:
$ pulumi import juju:index/machine:Machine machine_one `development:1:machine_one`
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- juju juju/terraform-provider-juju
- License
- Notes
- This Pulumi package is based on the
juju
Terraform Provider.