We have a large number of pipelines using terraform. We have some automation shared between these pipelines that’s aimed to make things predictable within the pipeline. At the start of each pipeline we do a terraform init to download the provider plugins and modules used by the terraform code. We then store this along with the version of terraform. In later stages of the pipelines we then use this to make sure to use the same version of terraform and the exact same provider version and modules, in order that changes we have tested in our staging environment are the same when we come to apply them to our production environment.
When we deploy into the staging or production environment our automation prepares the correct version of terraform and downloads the providers and modules. It then configures the backend for that environment (the environments are completely isolated) using a partial configuration and does a terraform init with the -get=false and -get-plugins=false to avoid changing the plugins and modules.
The 0.15 or 1.0 release removed the -get-plugins option from terraform init, saying:
The
-verify-plugins
and-get-plugins
options toterraform init
are no longer available. These have been non-functional since Terraform v0.13, with the introduction of the new Terraform Registry-based provider installer, because in practice there are very few operations Terraform can perform which both require aterraform init
but can also run without valid provider plugins installed.If you were using these options in automated calls to
terraform init
, remove them from the command line for compatibility with Terraform v0.15. There is no longer an option to initialize without installing the required provider plugins.
Is there still a way to achieve what we want: to know that the providers and modules are 100% the same between staging and production even if we run terraform init for each environment?
Thanks