Manage storage pools¶
See also: Juju | Storage , Juju | Storage pool
Reference an externally managed storage pool¶
To reference a storage pool that you’ve already created outside of the current Terraform plan, in your Terraform plan add a data source of the juju_storage_pool type, specifying the name of the storage pool and the UUID of its hosting model. For example:
data "juju_model" "my_model" {
name = "default"
}
data "juju_storage_pool" "my_storage_pool_data_source" {
name = "my-storage-pool"
model_uuid = data.juju_model.my_model.uuid
}
See more:
juju_storage_pool(data source)
Create a storage pool¶
To create a storage pool, in your Terraform plan add a resource of the juju_storage_pool type, specifying the name of the storage pool, the UUID of the model, and the storage provider type (for example, tmpfs, rootfs, loop, or a cloud-specific provider). You can optionally set attributes to pass provider-specific key-value pairs. For example:
resource "juju_storage_pool" "mypool" {
name = "mypool"
model_uuid = juju_model.development.uuid
storage_provider = "tmpfs"
attributes = {
a = "b"
c = "d"
}
}
See more:
juju_storage_pool(resource)
Update a storage pool¶
To update a storage pool, in your Terraform plan, in the storage pool resource definition, change the attributes map. Applying the plan will update the storage pool in place. For example:
resource "juju_storage_pool" "mypool" {
name = "mypool"
model_uuid = juju_model.development.uuid
storage_provider = "tmpfs"
attributes = {
a = "updated-value"
}
}
Changing the name or the storage_provider will force replacement of the storage pool.
See more:
juju_storage_pool(resource)
List storage pools¶
To list all storage pools in a model, use the list block with the juju_storage_pool resource type. You can optionally filter by name or storage_provider. For example:
list "juju_storage_pool" "this" {
provider = juju
include_resource = true
config {
model_uuid = juju_model.development.uuid
# Optional: filter by storage pool name
# name = "my-storage-pool"
# Optional: filter by storage provider
# storage_provider = "ebs"
}
}
See more:
juju_storage_pool(list resource)
Remove a storage pool¶
See also: Juju | Removing things
To remove a storage pool, remove its resource definition from your Terraform plan.
See more:
juju_storage_pool(resource)