Skip to content

[Bug]: Since upgrading to terraform 1.4.x, the provider keeps trying to remove and re-assign private networks #650

Description

@ttaghavi

What happened?

After upgrading from terraform 1.3.9 to 1.4.x, I see following behavior.

NOTE: Am using the latest version for terraform-provider-hcloud.

provider "registry.terraform.io/hetznercloud/hcloud" {
  version     = "1.37.0"
  constraints = "~> 1.37.0"

Network resources

resource "hcloud_network" "cluster_network_eu_central" {
  name     = "cluster-network-eu-central"
  ip_range = "10.0.0.0/16"

  delete_protection = false
}                                                                                                                      
                                                                                                                                                                                                                                              
resource "hcloud_network_subnet" "cluster_subnet_eu_central" {
  type         = "cloud"
  network_id   = hcloud_network.cluster_network_eu_central.id
  network_zone = "eu-central"
  ip_range     = "10.0.1.0/24"
}

The hcloud_server resource then uses this network via:

  network {
    network_id = hcloud_network.cluster_network_eu_central.id
  }

On a first run, everything is created correctly.

On subsequent runs (without changing any terraform files), I get:

 ~ resource "hcloud_server" "node" {
        id                         = "<server_id>"
        name                       = "server-fsn1-cpx11-1"
        # (18 unchanged attributes hidden)

      - network {
          - alias_ips   = [] -> null
          - ip          = "10.0.1.6" -> null
          - mac_address = "<mac_address> -> null
          - network_id  = <network_id> -> null
        }
      + network {
          + alias_ips   = (known after apply)
          + ip          = (known after apply)
          + mac_address = (known after apply)
          + network_id  = <network_id>
        }

        # (1 unchanged block hidden)
    }

Applying this plan detaches the private ip from the servers and re-attaches them. Further runs behave exactly the same.

Reverting back to 1.3.9 correctly shows:

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

What did you expect to happen?

Same output as 1.3.9.

Please provide a minimal working example

See What ahappened? field.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugpinnedrequires: plugin-frameworkThe issue can be fixed after the resource has be migrated to the plugin framework.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions