How to manage machines

See also: juju | Machine

Add a machine

To add a machine to a model, in your Terraform plan add a resource of the juju_machine type, specifying the model.

resource "juju_machine" "machine_0" {
  model       = juju_model.development.name
}

You can optionally specify a base, a name, regular constraints, storage constraints, etc. You can also specify a private_key_file, public_key_file, and ssh_address – that will allow you to add to the model an existing, manual machine (rather than a virtual one provisioned for you by the cloud).

Manage constraints for a machine

To set constraints for a machine, in your Terraform plan, in the machine resource definition, set the constraints attribute to the desired quotes-enclosed, space separated list of key=value pairs. For example:

resource "juju_machine" "machine_0" {
  model       = juju_model.development.name
  name        = "machine_0"
  constraints = "tags=my-machine-tag"
}

Remove a machine

To remove a machine, remove its resource definition from your Terraform plan.


Contributors: @alhama7a, @cderici, @tmihoc