mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-02-03 03:00:16 -05:00
This commit implements most of the intended functionality of the upgrade command for rewriting configurations. For a given module, it makes a list of all providers in use. Then it attempts to detect the source address for providers without an explicit source. Once this step is complete, the tool rewrites the relevant configuration files. This results in a single "required_providers" block for the module, with a source for each provider. Any providers for which the source cannot be detected (for example, unofficial providers) will need a source to be defined by the user. The tool writes an explanatory comment to the configuration to help with this.
10 lines
198 B
HCL
10 lines
198 B
HCL
# This file starts with a resource and a required providers block, and should
|
|
# end up with just the resource.
|
|
resource foo_instance a {}
|
|
|
|
terraform {
|
|
required_providers {
|
|
foo = "1.0.0"
|
|
}
|
|
}
|