Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Invalid Provider Server Combination #763

Closed
MichaelVoelkel opened this issue Oct 4, 2023 · 3 comments · Fixed by #764
Closed

[Bug]: Invalid Provider Server Combination #763

MichaelVoelkel opened this issue Oct 4, 2023 · 3 comments · Fixed by #764
Assignees
Labels

Comments

@MichaelVoelkel
Copy link

MichaelVoelkel commented Oct 4, 2023

What happened?

So I basically try to set up a simple Terraform script. Just a token, just a server, really simple (I hope). After the upgrade to 1.44.0 I get:

 Error: Failed to load plugin schemas
│ 
│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema for provider registry.terraform.io/hetznercloud/hcloud:
│ failed to retrieve schema from provider "registry.terraform.io/hetznercloud/hcloud": Invalid Provider Server Combination: The combined provider has differing provider
│ schema implementations across providers. Provider schemas must be identical across providers. This is always an issue in the provider implementation and should be
│ reported to the provider developers.

What did you expect to happen?

That it gives no error.

Please provide a minimal working example

So my main tf is:

provider "hcloud" {
    token = var.hcloud_token
}

resource "hcloud_ssh_key" "k8s_admin_key" {
  name       = "k8s_admin_key"
  public_key = file(var.ssh_public_key_filepath)
}

resource "hcloud_network" "network" {
    name = "kubenet"
    ip_range = "10.20.0.0/16"
}

resource "hcloud_server" "master" {
    count = var.master_node_count
    name = "${var.cluster_name}-master-${count.index + 1}"
    location = var.location
    server_type = var.master_type
    image = var.node_image
    ssh_keys = [hcloud_ssh_key.k8s_admin_key.id]

    connection {
        host = self.ipv4_address
        type = "ssh"
        private_ssh_key = file(var.private_ssh_key)
    }
}

Variables are filled accordingly, I hope all is speaking enough. But I might even have errors here but it does not come to this.

I am doing a fresh init & apply.

@annismckenzie
Copy link

We also ran into this just now in one of our CI pipelines. I looked at #749 and that refactoring effort breaks the provider.

The provider schema definitions are different:

https://github.com/hetznercloud/terraform-provider-hcloud/pull/749/files#diff-86978c2f5d893139f24fd19d3849c2fcf3f88ddc7cce5190f4e7e0bad2fc0dc7R44-R48

vs.

https://github.com/hetznercloud/terraform-provider-hcloud/pull/749/files#diff-60d4f1b041da05453d0b04458b428b1c0cb4a0108a619d8890165f97facf9177L46-L59

The old provider has Required: true and Optional: false while the new one has it the other way around. Version v1.43.0 still works.

@apricote
Copy link
Member

apricote commented Oct 5, 2023

Thanks for the report, fix is quite easy. Though I am curious why this was not detected in the e2e tests.

apricote added a commit that referenced this issue Oct 5, 2023
The schemas between the Plugin SDK Provider and the Plugin Framework
Provider have different values. This is not allowed, as it causes
inconstency, and the terraform-provider stops on startup with an error
if this is detected.

The "token" is not truly required in the old provider (or the new),
because we fallback to the HCLOUD_TOKEN environment variable and have
additional validation that verifies it is set.

Closes #763 

Related to #752
@apricote
Copy link
Member

apricote commented Oct 5, 2023

Please upgrade to v1.44.1

apricote added a commit that referenced this issue Oct 10, 2023
This refactors the code around #763 and adds a unit test to make sure
that the issue does not creep back in.

We are still not sure why this was not caught in the regular e2e tests.


Co-authored-by: jooola <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants