CacheTFProviders caches providers locally and generates a Terraform CLI config to use *only* that cache. This setup prevents network access for providers during `terraform init`, improving reliability in subsequent test runs. Returns the path to the generated CLI config file.
(t *testing.T, rootDir string, testName string, templateFiles map[string]string)
| 177 | // in subsequent test runs. |
| 178 | // Returns the path to the generated CLI config file. |
| 179 | func CacheTFProviders(t *testing.T, rootDir string, testName string, templateFiles map[string]string) string { |
| 180 | t.Helper() |
| 181 | |
| 182 | providersParentDir := DownloadTFProviders(t, rootDir, testName, templateFiles) |
| 183 | cliConfigPath := WriteTFCliConfig(t, providersParentDir) |
| 184 | return cliConfigPath |
| 185 | } |
nothing calls this directly
no test coverage detected