Manage machines¶
See also: Juju | Machine
Reference an externally managed machine¶
To reference a machine that you’ve already provisioned outside of the current Terraform plan, in your Terraform plan add a data source of the juju_machine
type, specifying the machine ID and the name of its hosting model. For example:
data "juju_machine" "this" {
model = juju_model.development.name
machine_id = "2"
}
See more:
juju_machine
(data source)
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).
See more:
juju_machine
(resource)
Manage constraints for a machine¶
See also: Juju | Constraint
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"
}
See more:
juju_machine
(resource)
Remove a machine¶
See also: Juju | Removing things
To remove a machine, remove its resource definition from your Terraform plan.
See more:
juju_machine
(resource)