rancher / terraform-provider-rancher2

Terraform Rancher2 provider
https://www.terraform.io/docs/providers/rancher2/
Mozilla Public License 2.0
260 stars 226 forks source link

terraform crashing with rancher2 provider after adding cloud_provider config #34

Closed ghost closed 5 years ago

ghost commented 5 years ago

This issue was originally opened by @richardmosquera as hashicorp/terraform#21753. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.12.2
+ provider.rancher2 v1.1.0

Terraform Configuration Files

resource "rancher2_cluster" "ld-nms" {
  name        = "ld-nms"
  description = "ld-nms cluster"

  rke_config {
    network {
      plugin = "canal"
    }

    cloud_provider {
      vsphere_cloud_provider {
        global {
          insecure_flag = true
        }

        virtual_center {
          name        = "<ip.address>"
          user        = "${var.vsphere_username}"
          password    = "${var.vsphere_password}"
          datacenters = "<DATACENTER>"
        }

        workspace {
          server            = "<ip.address>>"
          folder            = "kubernetes"
          default_datastore = "<CLUSTER>/<DATASTORE>"
          datacenter        = "<DATACENTER>"
        }
      }
    }
  }
}

Debug Output

https://gist.github.com/richardmosquera/b365f3fe064c4a37ef82acc60bd3b415

Crash Output

https://gist.github.com/richardmosquera/4424ef0ebf713b758bf1a2b33770caa2

Expected Behavior

Cloud provider should have been added to the cluster config.

Actual Behavior

Terraform crashed

Steps to Reproduce

Everything was working fine, terraform plan reported no changes. Crashes started happening when I added the cloud_config. However, even after removing it, it still crashed.

  1. terraform plan (0 changes)
  2. add cloud provider config as above
  3. terraform plan
  4. crash

Additional Context

To get terraform to not crash I had to delete the ld-nms cluster.

This is also not the first time it has happened. I've seen the same behavior with other resources.

References

rawmind0 commented 5 years ago

Hi @richardmosquera, I couldn't reproduce your issue. Have you tried with rancher2 provider v1.2.0??

Anyway, seeing your attached logs, i've submitted PR #35 to address the index out of range issue.

richardmosquera commented 5 years ago

I'm using 1.2 atm and still getting crashes. Again it was when I added a cloudprovider config to a cluster.

Terraform output: https://gist.github.com/richardmosquera/f96215719481f746767fe30908ba7cee

Crash.log: https://gist.github.com/richardmosquera/bfd76e09af363a1d488af3c5b4b86a29

rawmind0 commented 5 years ago

Fix is already merged. Could you please try to build rancher2 provider with fix make bin and test if it's working fine??

richardmosquera commented 5 years ago

Built plugin and ran with no crash after removing cloud provider.

Ill be working with terraform this afternoon, i'll update ticket if i get another crash.

rawmind0 commented 5 years ago

@richardmosquera , any update here?? Patch is working fine??

rawmind0 commented 5 years ago

@richardmosquera , please reopen issue if needed.