About this tool
Generate terraform required_providers and provider blocks with version constraints and alias configurations.
The Terraform Provider Block Generator writes the terraform block, the required_providers map and every matching provider block for you, complete with registry source addresses, version constraints and alias configurations. It follows the Terraform language rules exactly: a source address is [hostname/]namespace/type and defaults to registry.terraform.io, one provider block per provider may omit alias and become the default, and reusable child modules declare configuration_aliases instead of writing their own provider blocks. Output is formatted the way terraform fmt would leave it, with the = signs of consecutive arguments aligned.
Open Terraform Provider Block Generator on AltFTool — it loads instantly in your browser.
Paste your code or data sample into the workspace.
Pick the format, conversion, or analysis you need.
Copy the polished result straight back into your project.
Shows the exact window each operator opens: ~> 5.31.0 means >= 5.31.0 and < 5.32.0, while ~> 5.0 means >= 5.0 and < 6.0.
Rejects duplicate local names, two unaliased configurations of the same provider, invalid aliases and malformed source addresses before you run anything.
Adds the features {} block the azurerm provider has required since version 2.0 rather than letting init fail on it.
It is the pessimistic constraint operator, and it allows only the rightmost version component you wrote to increment. ~> 5.31.0 permits >= 5.31.0 and < 5.32.0, so only patch releases; ~> 5.0 permits >= 5.0 and < 6.0, so any 5.x minor. Terraform rejects ~> 5 because the operator needs at least a major and a minor component to know what is allowed to move.
Inside the terraform block, at the top level of the module: terraform { required_providers { aws = { source = "hashicorp/aws", version = "~> 5.31.0" } } }. Each entry is keyed by the provider's local name — the prefix of its resource types, so aws for aws_s3_bucket — and Terraform reads it during terraform init to select and download the plugin.
Write a second provider block with an alias meta-argument, then point individual resources at it. One block per provider may omit alias and is the default for everything; every extra block needs a unique alias, and resources select it with provider = aws.eu. If you have aliases but no default block, every resource of that provider must set provider explicitly or Terraform will error.
Because reusable child modules should not configure providers themselves — legacy provider blocks in a shared module make it impossible to remove the module cleanly. Declare the extra configurations the module expects with configuration_aliases = [aws.replica] inside required_providers, and have the calling module pass them in with a providers = { aws.replica = aws.eu } argument.