Manage applications¶
See also: Juju | Application
Reference an externally managed application¶
To reference an application that you’ve deployed outside of the current Terraform plan, in your Terraform plan add a data source of the juju_application type, specifying the name of the application and of the model it is deployed to. For example:
data "juju_application" "my-application" {
model_uuid = juju_model.development.uuid
application = "mattermost"
}
See more:
juju_application(data source)
Deploy an application¶
To deploy an application, find and deploy a charm that delivers it.
See more: Deploy a charm
Set the machine base for an application¶
Only for machine clouds.
TBA
Trust an application with a credential¶
Some applications may require access to the backing cloud in order to fulfil their purpose (e.g., storage-related tasks). In such cases, the remote credential associated with the current model would need to be shared with the application. When the Juju administrator allows this to occur the application is said to be trusted.
To trust an application with a credential, in the juju_application resource definition, add a trust attribute and set it to true:
resource "juju_application" "this" {
model_uuid = juju_model.development.uuid
charm {
name = "hello-kubecon"
}
trust = true
}
See more:
juju_application(resource)
Configure an application¶
See also: Juju | Application configuration
To configure an application, in its resource definition add a configuration map with the key=value pairs you want (from the list of configurations available for the charm).
resource "juju_application" "this" {
model_uuid = juju_model.development.uuid
charm {
name = "hello-kubecon"
}
config = {
redirect-map = "https://demo"
}
}
See more:
juju_application(resource)
Scale an application¶
See also: Juju | Scaling
Scale an application vertically¶
To scale an application vertically, set constraints for the resources that the application’s units will be deployed on.
See more: Manage constraints for an application
Scale an application horizontally¶
To scale an application horizontally, control the number of units.
See more: Control the number of units
Make an application highly available¶
See also: Juju | High availability (HA)
Find out if the charm delivering the application supports high availability natively or not. If the latter, find out what you need to do. This could mean integrating with a load balancing reverse proxy, configuring storage etc.
See more: Charmhub >
<your charm of interest>
Scale up horizontally as usual.
See more: Scale an application horizontally
Integrate an application with another application¶
See more: Manage relations
Manage an application’s public availability over the network¶
Expose. To expose an application over a network, in its resource definition use an expose attribute:
resource "juju_application" "this" {
model_uuid = juju_model.development.uuid
charm {
name = "hello-kubecon"
}
expose = {}
}
This will expose all of the application’s endpoints. To restrict exposure to just specific endpoints, spaces, or CIDRs, specify nested attributes.
Unexpose. To unexpose an application, remove the expose attribute from its resource definition.
Manage constraints for an application¶
See also: Juju | Constraint
To set constraints for an application, in its resource definition specify a constraints attribute followed by a quotes-enclosed, space-separated list of key=value pairs. For example:
resource "juju_application" "this" {
model_uuid = juju_model.development.uuid
charm {
name = "hello-kubecon"
}
constraints = "mem=6G cores=2"
}
See more:
juju_application(resource)
Change space bindings for an application¶
See also: Juju | Space
To set space bindings for an application, in its resource definition specify an endpoint_bindings with a space key, to set a default for the entire application, and/or a space and an endpoint key, to set the space binding for a particular application endpoint. For example, below all the application’s endpoints are bound to the public space except for the juju-info endpoint, which will be bound to the private space:
resource "juju_application" "application_three" {
model_uuid = resource.juju_model.testmodel.uuid
charm {
name = "juju-qa-test"
}
units = 0
endpoint_bindings = [
{
"space" = "public"
}
{
"space" = "private"
"endpoint" = "juju-info"
}
]
}
See more:
juju_application>endpoint_bindings
Upgrade an application¶
To upgrade an application, update its charm.
See more: Update a charm
Remove an application¶
See also: Juju | Removing things
To remove an application, remove its resource definition from your Terraform plan.
See more:
juju_application(resource)