Add download_retry_count for direct and network_mirror in CLI configuration (#3368)

Signed-off-by: Andrei Ciobanu <andrei.ciobanu@opentofu.org>
This commit is contained in:
Andrei Ciobanu
2025-10-18 11:42:25 +03:00
committed by GitHub
parent dc9bec611c
commit 4f57c826f0
13 changed files with 409 additions and 40 deletions

View File

@@ -278,6 +278,29 @@ identity, but a network mirror with a TLS certificate can potentially serve
modified copies of upstream providers with malicious content.
:::
The `direct` and `network_mirror` methods support an additional argument
`download_retry_count`. When specified, it will be used to retry downloading
the provider binary in case of retryable errors (connection reset and a range of 500 errors).
```hcl
provider_installation {
network_mirror {
url = "https://example.com/"
include = ["example.com/*/*"]
download_retry_count = 2
}
direct {
exclude = ["example.com/*/*"]
download_retry_count = 3
}
}
```
You can use this argument to disable fully the retries in case of a specific method (`download_retry_count = 0`).
:::info
When used together with [`TF_PROVIDER_DOWNLOAD_RETRY`](./environment-variables.mdx#tf_provider_download_retry), the configuration value
will be used for each method that it is configured with. For the methods
with no such configuration, the environment variable will be used instead.
:::
OpenTofu will try all of the specified methods whose include and exclude
patterns match a given provider, and select the newest version available across
all of those methods that matches the version constraint given in each

View File

@@ -165,7 +165,9 @@ For more details on `.terraformignore`, please see [Excluding Files from Upload
Set `TF_PROVIDER_DOWNLOAD_RETRY` to configure the max number of request retries
the remote provider client will attempt for client connection errors or
500-range responses that are safe to retry.
:::info
This will be used only for the methods without the argument `download_retry_count` specified in [OpenTofu CLI configuration file](./config-file.mdx#explicit-installation-method-configuration).
:::
```shell
export TF_PROVIDER_DOWNLOAD_RETRY=3
```