> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/infrastructure-as-code-management/platform/iacm-connectors-variables/iacm-plugins/plugin-binary-dir.md).

# PLUGIN\_BINARY\_DIR

Configure PLUGIN\_BINARY\_DIR so the IaCM plugin uses a pre-baked provisioner binary from a custom image instead of downloading one at runtime.

Specifies the directory in a custom plugin image that contains a pre-baked provisioner binary. When set, the IaCM plugin uses the binary from this directory instead of downloading the provisioner at runtime. This is useful in environments where runtime downloads are unreliable or restricted, such as environments with no outbound internet access or environments with intermittent access to external registries.

**Applies to:** Terraform, OpenTofu, and Terragrunt.

**When to use it:** Use this variable when you build a custom plugin image that includes a pre-baked OpenTofu or Terraform binary and want the plugin to use that binary instead of downloading it at runtime. Pre-baking the binary can help avoid failures caused by restricted or unreliable network access to external registries.

***

## Requirements <a href="#requirements" id="requirements"></a>

* Place the provisioner binary directly in the specified directory, not in a subdirectory.
* Include the binary in the custom plugin image before using the image in a pipeline.
* Set the variable to the directory containing the binary.

**How it works:** When `PLUGIN_BINARY_DIR` is set, the IaCM plugin scans the specified directory for a binary that matches the provisioner version declared in the workspace. If the directory holds more than one pre-baked binary, the plugin picks the matching version automatically. If none of the binaries match, the plugin downloads the required version at runtime instead.

***

## Configure PLUGIN\_BINARY\_DIR <a href="#configure-pluginbinarydir" id="configure-pluginbinarydir"></a>

1. Build a custom plugin image that includes the pre-baked binary. For example:

   ```dockerfile
   FROM docker.io/plugins/harness_terraform:0.270.0
   COPY tofu /opt/iacm-binaries/tofu
   ```
2. Add a workspace environment variable with:
   * **Key:** `PLUGIN_BINARY_DIR`
   * **Value:** The directory containing the binary (for example, `/opt/iacm-binaries`).
3. Re-run the pipeline.

**Verify:** Check the **Installing provisioner** step logs to confirm that the pre-baked binary is detected and used instead of being downloaded at runtime.

***

## Next steps <a href="#next-steps" id="next-steps"></a>

* Go to [IaCM plugins](/infrastructure-as-code-management/platform/iacm-connectors-variables/iacm-plugins.md) for the full list of plugin environment variables.
* Go to [Custom images for OpenTofu](/infrastructure-as-code-management/use-iacm/iac-provisioners/opentofu/custom-images.md) to build a custom plugin image.

{% @harness-feedback/feedback %}
