hashicorp/terraform · error
No more than one provider_installation block may be…
Error message
No more than one provider_installation block may be specified
What it means
Thrown when the CLI configuration contains more than one provider_installation block. Terraform permits at most one provider_installation block to keep provider installation methods unambiguous. Multiple installation methods should be nested as separate method blocks within a single provider_installation block.
Solutions
- Consolidate into a single provider_installation block with multiple nested method blocks (filesystem_mirror, direct, etc.)
- Remove duplicate provider_installation blocks
- Review all config files in the merge chain
Example fix
// before
provider_installation {
filesystem_mirror { path = "/local/mirror" }
}
provider_installation {
direct {}
}
// after
provider_installation {
filesystem_mirror { path = "/local/mirror" }
direct {}
} Defensive patterns
Strategy: validation
Validate before calling
// Count provider_installation blocks in config before deployment
func countProviderInstallations(path string) (int, error) {
src, err := os.ReadFile(path)
if err != nil {
return 0, err
}
return strings.Count(string(src), "provider_installation"), nil
} Prevention
- Use a single provider_installation block with multiple nested method blocks (filesystem_mirror, direct, etc.)
- Avoid defining provider_installation in multiple merged config files
- Review full config after merging files for duplicate top-level blocks
- Consolidate provider installation methods rather than duplicating the block
When it happens
Trigger: len(c.ProviderInstallation) > 1 after parsing. Occurs when multiple provider_installation blocks are defined in one file or appear across merged config files.
Common situations: Adding a new provider_installation block without removing the old one; merging config files that each define provider_installation; copy-paste from documentation alongside existing config.
Related errors
- No more than one credentials_helper block may be specified
- The credentials block has an invalid hostname
- The host block has an invalid hostname
- The specified plugin cache dir
- architecture portion must not contain whitespace
AI-assisted analysis of hashicorp/terraform@d32a084675 (2026-08-11).
Data as JSON: /api/errors/f4a17611c9256fcc.
Report an issue: GitHub.
Appendix: source
Thrown at internal/command/cliconfig/cliconfig.go:323
_, err := svchost.ForComparison(givenHost)
if err != nil {
diags = diags.Append(
fmt.Errorf("The credentials %q block has an invalid hostname: %s", givenHost, err),
)
}
}
// Should have zero or one "credentials_helper" blocks
if len(c.CredentialsHelpers) > 1 {
diags = diags.Append(
fmt.Errorf("No more than one credentials_helper block may be specified"),
)
}
// Should have zero or one "provider_installation" blocks
if len(c.ProviderInstallation) > 1 {
diags = diags.Append(
fmt.Errorf("No more than one provider_installation block may be specified"),
)
}
if c.PluginCacheDir != "" {
_, err := os.Stat(c.PluginCacheDir)
if err != nil {
diags = diags.Append(
fmt.Errorf("The specified plugin cache dir %s cannot be opened: %s", c.PluginCacheDir, err),
)
}
}
return diags
}
// Merge merges two configurations and returns a third entirely
// new configuration with the two merged.
func (c *Config) Merge(c2 *Config) *Config {View on GitHub (pinned to d32a084675)