ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
34 stars 23 forks source link

Wants to update "ssh_key_path" although not configured / not changed #19

Closed larsen0815 closed 3 years ago

larsen0815 commented 3 years ago

Description

I have imported a datacenter and server. Adapted the main.tf to resemble the current state. When I run "terraform plan", I get this:


  # ionoscloud_server.Vermont will be updated in-place
  ~ resource "ionoscloud_server" "Vermont" {
        id                = "123-456"
        name              = "Vermont Server"
      + ssh_key_path      = (known after apply)
        # (9 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

It's null in terraform.tfstate:

# grep ssh_key_path terraform.tfstate
            "ssh_key_path": null,
                "ssh_key_path": []

When I change main.tf to include "ssh_key_path = null", terraform still wants to set "ssh_key_path".

Expected behavior

I'm not sure if this is already the expected behaviour, but I think the ionoscloud provider shouldn't want to change "ssh_key_path".

Environment

Terraform version:

Terraform v1.0.0
on linux_amd64

Provider version:

+ provider registry.terraform.io/ionos-cloud/ionoscloud v5.1.6

OS:

Debian GNU/Linux 10 (buster)

Configuration Files

main.tf:

resource "ionoscloud_datacenter" "example" {
  name        = "example"
  location    = "de/fra"
}

resource "ionoscloud_lan" "LAN_1" {
  datacenter_id = ionoscloud_datacenter.example.id
  public        = true
}

resource "ionoscloud_ipblock" "Vermont" {
  location = "${ionoscloud_datacenter.example.location}"
  size     = 1
  name     = "Vermont"
}

resource "ionoscloud_server" "Vermont" {
  name              = "Vermont Server"
  datacenter_id     = "${ionoscloud_datacenter.example.id}"
  cores             = 8
  ram               = 12288
  availability_zone = "AUTO"
  cpu_family        = "INTEL_XEON"

  volume {
    name           = "Vermont SSD-Storage"
    size           = 100
    disk_type      = "SSD Premium"
  }

  nic {
    lan             = "${ionoscloud_lan.LAN_1.id}"
    dhcp            = true
    ip              = "${ionoscloud_ipblock.Vermont.ips[0]}"
  }
}
iblindu commented 3 years ago

Fixed in both v5.2.14 and v6.0.0-beta.10