# juju_action (Resource)

A resource that represents a Juju action. The action is run and its result awaited during the resource’s creation. The action’s output is set as a computed field that can be used by other resources after the resource has been created.

## Example Usage

```terraform
resource "juju_action" "action" {
  model_uuid       = juju_model.development.uuid
  application_name = juju_application.traefik.name
  action_name      = "show-proxied-endpoints"
}

# The action output can be used by other resources. For example, to
# fetch a nested value from a JSON string result:
locals {
  application_proxied_url = jsondecode(juju_action.action.output.proxied-endpoints)[juju_application.traefik.name].url
}
```

<!-- schema generated by tfplugindocs -->

## Schema

### Required

- `action_name` (String) The name of the action to run. Changing this value will cause the resource to be destroyed and recreated.
- `application_name` (String) The name of the application to run the action on. Changing this value will cause the resource to be destroyed and recreated.
- `model_uuid` (String) The UUID of the model where the action will be run. Changing this value will cause the resource to be destroyed and recreated.
- `unit` (String) The unit name (e.g. “ubuntu/0” or “ubuntu/leader”) to run the action on. Changing this value will cause the resource to be destroyed and recreated.

### Optional

- `args` (Map of String) The arguments to pass to the action. Changing this value will cause the resource to be destroyed and recreated.

### Read-Only

- `action_id` (String) The ID of the enqueued action.
- `id` (String) The ID of this resource.
- `output` (String) The output of the action as a JSON string. Use jsondecode() to extract values from it.
