Closed ivanfitenko closed 2 years ago
Is that the same outcome as #305 ?
Is that the same outcome as #305 ?
The outcome is the same: terraform
, tfenv use
and tfenv install
will pick version from terraform files unless overriden by parameters, environment variables or .terraform-version files.
The difference here is that you do not even need to set any environment variables: the feature becomes a part of the default behavior.
@Zordrak is there any chance for this to be reviewed anytime soon?
Bear in mind I will be semi-reverting this shortly. I have merged it prematurely and it's very dangerous logic. We cannot use a rough-guess semver match - that doesnt account for anything other than a minimum viable version - to override the preferences a user set with tfenv use
This PR enables automatic use of required_version setting under "terraform" section in any of .tf or tf.json files for tfenv install and use commands, and, consequentially, for bin/terraform wrapper itself. The PR tries to combine the functionality present in .terraform-version feature, where you can just run commands without parameters and the version is automatically detected without a need to run any additional commands, and the functionality of min-required feature, where you can detect the version from native terraform configurations without a need to add new configuration files to existing code.
So with that, it becomes possible to just run terraform command against a pre-existing terraform configuration, and have a correspoinding terraform version installed and used, without any need to add new files or reconfigure CI/CD-related automations.