<a id="reference-terraform"></a>

# Terraform

The osquery charm ships a Terraform module that wraps the [Juju Terraform
provider](https://registry.terraform.io/providers/juju/juju/latest), so you can
deploy and manage the charm declaratively. The module source lives in the
`terraform/` directory of the [code repository](https://github.com/canonical/osquery-operator).

For step-by-step usage instructions, see [How to deploy with Terraform](https://canonical.com/juju/docs/osquery-charm/latest/how-to/terraform/index.html.md#how-to-terraform).

## Module contents

| File           | Purpose                                                         |
|----------------|-----------------------------------------------------------------|
| `main.tf`      | Declares the `juju_application` resource for the osquery charm. |
| `variables.tf` | Declares the module’s input variables.                          |
| `outputs.tf`   | Declares the module’s outputs, such as the application name.    |
| `versions.tf`  | Pins the required Terraform and provider versions.              |

Because osquery is a subordinate charm, the module intentionally omits the
`units` input: Juju co-locates one osquery unit next to every unit of the
principal application it’s related to. The module exposes an `app_name` output
and a `requires` output that surfaces the `general-info` endpoint, so
higher-level modules can integrate osquery with a principal application.

The authoritative description of the module’s inputs and outputs is maintained
alongside the module itself in the
[Terraform module README](https://github.com/canonical/osquery-operator/blob/main/terraform/README.md).

<!-- TODO: Publish the module to the Terraform Registry and link it here once
available. -->
