Overview
To improve performance in infrastructure-as-code environments, env zero supports an optional plugin cache. This cache stores previously downloaded provider plugins on a persistent volume, allowing reuse across runs within the same environment. The plugin cache can reduce run times and avoid redundant downloads when enabled. This caching mechanism is opt-in and requires specific environment variables. It is supported only for environments running with a self-hosted Kubernetes agent that uses PVC.Prerequisites
Before enabling plugin caching, ensure that:- You are using Self-Hosted Kubernetes Agent (SHAG) v3.0.1082 or above
- Your agent is already configured to use Persistent Volume Claims (PVC)
- You are running OpenTofu, Terraform, or Terragrunt
Enabling Plugin Cache
There are two supported ways to use plugin caching with PVC:Option 1 - Agent’s Existing PVC (Recommended)
If your agent is already configured with a PVC (e.g., for state, working directory, etc.), enable caching by setting:- As an Organization or Project Environment Variable in env0
Option 2 – Using a Dedicated PVC for Terraform Plugin Cache (Advanced)
If you have multiple PVCs, and you want to explicitly choose which PVC is used for Terraform plugin cache, then do not setENV0_USE_TF_PLUGIN_CACHE=true
Instead, set the following in your Helm values under agentAdditionalEnvVars (or podAdditionalEnvVars):
Wiping the Cache
If you need to wipe the plugin cache before a run (for example, to force re-downloading of providers or resolve potential cache issues), set the following additional environment variable:ENV0_WIPE_TF_PLUGIN_CACHE=true
This variable only takes effect if
ENV0_USE_TF_PLUGIN_CACHE is also set.Next steps
- Self-Hosted Kubernetes Agent - Configure the persistent volume storage class.
- Custom/Optional Configuration - Set
agentAdditionalEnvVarsfor cache path overrides. - env zero Hosted Encrypted State - Skip PVC setup using encrypted hosted state.