Manage the Terraform Provider for Juju¶
Install the Terraform Provider for Juju¶
To install the Terraform Provider for Juju on Linux, macOS, or Windows, you need to install the terraform
CLI.
See more: Hashicorp | Install Terraform
For example, on a Linux that supports snaps:
sudo snap install terraform --classic
Use the Terraform Provider for Juju¶
To use the Terraform Provider for Juju, create a Terraform plan specifying the juju
provider, an existing Juju or JIMM controller, and resources or data sources for whatever Juju entities you want to deploy, then apply your plan in the usual Terraform way.
1. Build your Terraform plan¶
a. Configure Terraform to use the juju
provider¶
In your Terraform plan, add:
terraform {
required_providers {
juju = {
version = "~> 0.19.0"
source = "juju/juju"
}
}
}
b. Configure the juju
provider to use an existing Juju or JIMM controller¶
In your Terraform plan, configure the provider
with the details of your existing, externally managed Juju or JIMM controller.
See more: {ref}
c. Build your deployment¶
See more: How-to guides
2. Apply your Terraform plan¶
In a terminal, in your project directory, run:
a. (just the first time) terraform init
to initialise your project;
b. terraform plan
to stage the changes; and
c. terraform apply
to apply the changes to your Juju deployment.
Upgrade the Terraform Provider for Juju¶
To upgrade the Terraform Provider for Juju, in your Terraform plan update the version constraint, then run terraform init
with the --upgrade
flag.
See more: Terraform Version constraints ,
terraform init --upgrade