Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

rancher_host resource should be replaced on hostname change #82

Closed
eliaoggian opened this issue Jul 17, 2018 · 3 comments
Closed

rancher_host resource should be replaced on hostname change #82

eliaoggian opened this issue Jul 17, 2018 · 3 comments

Comments

@eliaoggian
Copy link

Terraform Version

terraform 0.11.7
provider.rancher v1.2.1

Affected Resource(s)

  • rancher_host

Terraform Configuration Files

resource "rancher_host" "host" {
  count          = "${var.dev_hosts_count}"
  name           = "${random_pet.hostname.*.id[count.index]}.${var.dev_domain}"
  hostname       = "${random_pet.hostname.*.id[count.index]}.${var.dev_domain}"
  environment_id = "${data.rancher_environment.terraform.id}"

  lifecycle {
    create_before_destroy = true
  }

  depends_on = ["vsphere_virtual_machine.vm"]
}

Debug Output

None.

Panic Output

None.

Expected Behavior

As a new vsphere_virtual_machine.vm resource is created, the hostname changes and there sould be a rancher_host resource replacement as well, the new host is created by the provisioner of the VM:

  provisioner "remote-exec" {
    connection {
      type     = "ssh"
      user     = "root"
      password = "${var.root_password}"
    }

    inline = [
      # Add host to rancher
      "${rancher_registration_token.rancher-token.command}",

      # Wait for load balancer service to be up and running
      "sleep 20",
    ]
  }

Actual Behavior

The rancher_host resource gets renamed, which results in having two hosts in rancher, one up and runnig and another one with the same name, which is the old VM that has been deleted.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. edit the vsphere_virtual_machine.vm resource template attribute which forces the replacement of the resource
  3. terraform apply

Important Factoids

This behaviour should be configurable on the rancher_host resource, with something like triggers or keepers on null_resource and random provider.

References

@raphink
Copy link
Contributor

raphink commented Oct 18, 2018

@eliaoggian does #86 fix this for you?

@eliaoggian
Copy link
Author

@raphink I am not using the resource anymore as I am interacting directly with rancher's API. I will test it and report here if it's still causing the issue! Thanks

@raphink
Copy link
Contributor

raphink commented Oct 19, 2018

OK thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants