# Install with Terraform

If you are using Terraform to manage your Kubernetes infrastructure, use the [Terraform Helm provider](https://github.com/hashicorp/terraform-provider-helm) by HashiCorp or [opentofu/helm](https://search.opentofu.org/provider/opentofu/helm/latest) provider to install Kedify Agent. The example installs the Agent, KEDA and HTTP Scaler.

## Configure the Helm release

Obtain the [organization ID and Agent API key](https://docs.kedify.io/installation/helm/#prepare-installation) first. Replace placeholders through your existing secret-management workflow. Terraform can retain credentials in state; use an access-controlled backend.

```hcl
provider "helm" {
  kubernetes = {
    config_path = "~/.kube/config"
  }
}

resource "helm_release" "kedify-agent" {
  name              = "kedify-agent"
  repository        = "https://kedify.github.io/charts"
  chart             = "kedify-agent"
  version           = "v0.7.1"
  namespace         = "keda"
  wait              = false
  atomic            = false
  create_namespace  = true
  dependency_update = true

  values = [
    // file("${path.module}/agent-common-values.yaml"),
    yamlencode({
      clusterName = "my-cluster"
      agent = {
        orgId = "$YOUR_ORG_ID"
        apiKey = "$YOUR_API_KEY"
      }
      keda = {
        enabled = true
      }
      keda-add-ons-http = {
        enabled = true
      }
    })
  ]
}
```

With `wait=false` and `atomic=false`, Terraform does not wait for workload readiness or automatically roll back a failed Helm deployment. Run the checks below after applying. To enable Helm waiting or rollback, first verify hook completion with your selected chart and provider versions.

## Apply and verify

Run `terraform plan` with your selected Helm provider and chart versions before applying.

```bash
terraform init
terraform plan
terraform apply
```

With `wait=false`, a successful apply does not establish component readiness. Run the [installation checks](https://docs.kedify.io/installation/helm/#verifying-installation).

---
Canonical: https://docs.kedify.io/installation/terraform/
Source: src/pages/installation/terraform.astro
Documentation index: https://docs.kedify.io/llms.txt
