How to migrate from plugins to Terraform 0.13 registry providers
If you are using external community Terraform 0.12 plugin/provider, you should migrate to Terraform 0.13 and use required_providers instead of downloading provider from Github and extracting to ~/.terraform.d/plugins/
folder.
But there will be some circumstances
In Terraform 0.13 you have to define required_providers
and use new Hashicorp Registry - in my case "timohirt/hetznerdns" https://registry.terraform.io/providers/timohirt/hetznerdns/latest/docs
terraform {
required_providers {
hetznerdns = {
source = "timohirt/hetznerdns"
version = "1.0.7"
}
}
}
But after terraform init you will end up with error
Initializing provider plugins...
- Using previously-installed timohirt/hetznerdns v1.0.7
- Finding latest version of -/hetznerdns...
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider -/hetznerdns:
provider registry registry.terraform.io does not have a provider named
registry.terraform.io/-/hetznerdns
You have to replace your old plugin with new provider with this command (replace your provider name with yours)
terraform state replace-provider "registry.terraform.io/-/hetznerdns" timohirt/hetznerdns
Result
Terraform will perform the following actions:
~ Updating provider:
- registry.terraform.io/-/hetznerdns
+ registry.terraform.io/timohirt/hetznerdns
Changing 20 resources:
module.recepty_eu_records.hetznerdns_record.gsuite_docs
module.recepty_eu_records.hetznerdns_record.mxalt4
module.recepty_eu_records.hetznerdns_record.root6
module.recepty_eu_records.hetznerdns_record.mx
module.recepty_eu_records.hetznerdns_record.mxalt2
module.recepty_eu_records.hetznerdns_record.txtbrave
module.recepty_eu_records.hetznerdns_record.acmechallenge
module.recepty_eu_records.hetznerdns_record.txtgoogle
module.recepty_eu_records.hetznerdns_record.txtspf
module.recepty_eu_records.hetznerdns_record.all
module.recepty_eu_records.hetznerdns_record.txtdkim
module.recepty_eu_records.hetznerdns_record.gsuite_calendar
module.recepty_eu_records.hetznerdns_record.bingsiteverification
module.recepty_eu_records.hetznerdns_record.root
module.recepty_eu_records.hetznerdns_zone.zone1
module.recepty_eu_records.hetznerdns_record.www
module.recepty_eu_records.hetznerdns_record.gsuite_mail
module.recepty_eu_records.hetznerdns_record.mxalt3
module.recepty_eu_records.hetznerdns_record.txtdmarc
module.recepty_eu_records.hetznerdns_record.mxalt1
Do you want to make these changes?
Only 'yes' will be accepted to continue.
Enter a value: yes
Successfully replaced provider for 20 resources.