timohirt / terraform-provider-hetznerdns

Terraform provider for Hetzner DNS
Mozilla Public License 2.0
106 stars 21 forks source link

Cannot update to 1.2.0: Failed to query available provider packages #33

Closed ThomasLandauer closed 2 years ago

ThomasLandauer commented 2 years ago

When I change the version from 1.1.1 to 1.2.0 at

        hetznerdns = {
            source = "timohirt/hetznerdns"
            version = "1.2.0"
        }

... and run terraform init -upgrade, I'm getting:

Initializing provider plugins...
- Finding hetznercloud/hcloud versions matching "1.32.2"...
- Finding timohirt/hetznerdns versions matching "1.1.1, 1.2.0"...
- Using previously-installed hetznercloud/hcloud v1.32.2
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider timohirt/hetznerdns: no available releases match the given constraints 1.1.1, 1.2.0
Xzelsius commented 2 years ago

I get a similar error

Initializing provider plugins...
- Reusing previous version of hashicorp/azurerm from the dependency lock file
- Reusing previous version of timohirt/hetznerdns from the dependency lock file
- Finding latest version of hashicorp/hetznerdns...
- Installing hashicorp/azurerm v2.92.0...
- Installed hashicorp/azurerm v2.92.0 (signed by HashiCorp)
- Installing timohirt/hetznerdns v1.1.0...
- Installed timohirt/hetznerdns v1.1.0 (self-signed, key ID 5218E983F21C1625)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider
│ hashicorp/hetznerdns: provider registry registry.terraform.io does not have
│ a provider named registry.terraform.io/hashicorp/hetznerdns

Fun part actually... If I check providers

❯ terraform providers

Providers required by configuration:
.
├── provider[registry.terraform.io/timohirt/hetznerdns] 1.1.0
├── provider[registry.terraform.io/hashicorp/azurerm] >= 2.92.0
├── module.azure
│   └── provider[registry.terraform.io/hashicorp/azurerm]
└── module.hdns
    └── provider[registry.terraform.io/hashicorp/hetznerdns]

Although the only resource in module.hdns is

resource "hetznerdns_zone" "example.com" {
  name = "example.com"
  ttl  = var.default_ttl
}

Any idea on how to solve this issue? Happens with both, 1.1.1 and 1.2.0

Edit: Damn it... I did miss that one

image

timohirt commented 2 years ago

Could not retrieve the list of available versions for provider │ hashicorp/hetznerdns: provider registry registry.terraform.io does not have │ a provider named registry.terraform.io/hashicorp/hetznerdns

@Xzelsius that's correct. The provider should be timohirt/hetznerdns and not hashicorp/hetznerdns. Ich you don't find hashicorp/hetznerdns in your code, would you please check your state file?

I just update the provider in one of my projects to version 1.2.0.

terraform init                                               
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/random versions matching "2.3.0"...
- Finding timohirt/hetznerdns versions matching "1.2.0"...
- Finding hetznercloud/hcloud versions matching "1.20.1"...
- Installing hashicorp/random v2.3.0...
- Installed hashicorp/random v2.3.0 (signed by HashiCorp)
- Installing timohirt/hetznerdns v1.2.0...
- Installed timohirt/hetznerdns v1.2.0 (self-signed, key ID 5218E983F21C1625)
- Installing hetznercloud/hcloud v1.20.1...
- Installed hetznercloud/hcloud v1.20.1 (signed by a HashiCorp partner, key ID 5219EACB3A77198B)

Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

Could you check or post .terraform.lock.hcl?

Xzelsius commented 2 years ago

I am using a child module structure. And I did miss the part in the documentation where I have to specify required_providers in the child module again (unless it is a hashicorp/... provider).

image

I simply added another meta.tf file (red arrow) with

terraform {
  required_providers {
    hetznerdns = {
      source  = "timohirt/hetznerdns"
      version = "1.2.0"
    }
  }
}

Now it works as expected :)

timohirt commented 2 years ago

That's good to hear 🙂.

How about you @ThomasLandauer?

ThomasLandauer commented 2 years ago

Thanks guys, I also didn't know that I need to upgrade the version in each module. Is there a better way to do this than just copy-pasting? I have several modules based on this provider, but they're all independent (no child modules), so just creating a meta.tf didn't work.