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

Changes to ignored attributes aren't ignored in CustomizeDiff #22520

Closed
bill-rich opened this issue Aug 19, 2019 · 1 comment · Fixed by #22691
Closed

Changes to ignored attributes aren't ignored in CustomizeDiff #22520

bill-rich opened this issue Aug 19, 2019 · 1 comment · Fixed by #22691
Labels
bug core v0.12 Issues (primarily bugs) reported against v0.12 releases

Comments

@bill-rich
Copy link

Terraform Version

Terraform v0.12.6

Terraform Configuration Files

provider "vsphere" {
  user           = var.vsphere_user
  password       = var.vsphere_password
  vsphere_server = var.vsphere_server

  # If you have a self-signed cert
  allow_unverified_ssl = true
}

data "vsphere_datacenter" "dc" {
  name = var.dc
}

data "vsphere_datastore" "datastore" {
  name          = var.datastore
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_compute_cluster" "cluster" {
  name          = var.cluster
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_network" "network" {
  name          = var.network
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_virtual_machine" "template" {
  name          = var.template
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_virtual_machine" "vm" {
  name                       = var.vm_name
  resource_pool_id           = data.vsphere_compute_cluster.cluster.resource_pool_id
  datastore_id               = data.vsphere_datastore.datastore.id
  num_cpus                   = 2
  memory                     = 1024
  guest_id                   = data.vsphere_virtual_machine.template.guest_id
  scsi_type                  = data.vsphere_virtual_machine.template.scsi_type
  annotation                 = "test"
  wait_for_guest_net_timeout = -1
  network_interface {
    network_id   = data.vsphere_network.network.id
    adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
  }
  disk {
    label          = "disk1"
    datastore_id   = data.vsphere_datastore.datastore.id
    size           = "${var.disk_size}"
    io_share_count = 1000
  }
  clone {
    template_uuid = data.vsphere_virtual_machine.template.id
  }
  lifecycle {
    ignore_changes = [
      clone[0].template_uuid,
      disk[0].datastore_id,
      disk[0].io_share_count,
      disk[0].size,
      disk[0].label,
    ]
  }
}

Debug Output

https://gist.github.com/bill-rich/455d59a7fb9a8d09a5b23674557aadb1

Expected Behavior

No changes should be made to disk.0 because all changed attributes are ignored.

Actual Behavior

CustomizeDiff still runs and modifies disk.0 because the changes are still returned from GetChange. See line 2738 for the output of GetChange.

Steps to Reproduce

  1. Deploy resource that utilizes CustomizeDiff and modifies plan based on changes.
  2. Use lifecycle to ignore changes to attributes that would trigger CustomizeDiff to make modifications.
  3. Make change to attribute that would trigger CustomizeDiff to make modifications.
@ghost
Copy link

ghost commented Oct 12, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Oct 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug core v0.12 Issues (primarily bugs) reported against v0.12 releases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants