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

inconsistent final plan #1699

Open
Dialgatrainer02 opened this issue Jan 6, 2025 · 0 comments
Open

inconsistent final plan #1699

Dialgatrainer02 opened this issue Jan 6, 2025 · 0 comments
Labels
🐛 bug Something isn't working

Comments

@Dialgatrainer02
Copy link

Dialgatrainer02 commented Jan 6, 2025

Describe the bug
terraform fatally errors saying the plan is inconsistent

To Reproduce
Steps to reproduce the behavior:

  1. Create a container
  2. create a terraform data that's triggers replace is the container
  3. See error

Please also provide a minimal Terraform configuration that reproduces the issue.

resource "proxmox_virtual_environment_container" "proxmox_ct" {

  description = var.container.description

  started   = true
  node_name = local.node
  vm_id     = local.vm_id

  unprivileged = var.container.unprivileged

  initialization {
    hostname = var.container.hostname

    ip_config {
      ipv4 {
        address = var.container.ipv4_address
        gateway = var.container.ipv4_gateway != null ? var.container.ipv4_gateway : null
      }
    }
    dns {
      servers = var.container.dns
    }

    user_account {
      keys = [
        local.public_key
      ]
    }
  }
  cpu {
    cores = var.container.cores
  }

  disk {
    datastore_id = local.datastore_id
    size         = var.container.disk
  }
  memory {
    dedicated = var.container.memory
    swap      = var.container.swap
  }

  network_interface {
    name = "veth0"
  }

  operating_system {
    template_file_id = var.container.os_image
    # Or you can use a volume ID, as obtained from a "pvesm list <storage>"
    # template_file_id = "local:vztmpl/jammy-server-cloudimg-amd64.tar.gz"
    type = var.container.os_type
  }
  start_on_boot = var.container.startup

  mount_point {
    volume = "/mnt/bindmounts/terraform"
    path   = "/terraform"
    shared = "true"
  }
}

resource "terraform_data" "provision" {
  triggers_replace = [proxmox_virtual_environment_container.proxmox_ct, ]
  connection {
    host     = var.pve_settings.pve_address
    type     = "ssh"
    user     = local.pve_user
    password = var.pve_settings.pve_password
  }

  provisioner "file" {
    source      = "${path.module}/enable_ssh.sh"
    destination = "/mnt/bindmounts/terraform/enable_ssh.sh"

  }
  provisioner "remote-exec" {
    inline = [
      "pct exec ${local.vm_id} bash /terraform/enable_ssh.sh" # vmid goes in space
    ]
  }
}

and the output of terraform|tofu apply.


Expected behavior
plan completes and whena container is changed destroyed or made the terraform data is triggered

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.
i used to use depends on instead of triggers replace but during tofu apply i was running into issues where it was being skipped to swapped it to triggers replace and it gave the error

  • Single or clustered Proxmox: 2 node cluster(ik)
  • Proxmox version: 8.2.2
  • Provider version (ideally it should be the latest version): 0.69
  • Terraform/OpenTofu version:OpenTofu v1.8.8
    on linux_amd64
  • provider registry.opentofu.org/bpg/proxmox v0.69.0
  • provider registry.opentofu.org/hashicorp/local v2.5.2
  • provider registry.opentofu.org/hashicorp/oci v6.21.0
  • provider registry.opentofu.org/hashicorp/random v3.6.3
  • provider registry.opentofu.org/hashicorp/tls v4.0.6
  • OS (where you run Terraform/OpenTofu from): arch linux
  • Debug logs (TF_LOG=DEBUG terraform apply):
    out.txt

ps can you add a warning to the bug report that tflog debug does show your pve password a\nd to remind people to crtl f and remove it

@Dialgatrainer02 Dialgatrainer02 added the 🐛 bug Something isn't working label Jan 6, 2025
@Dialgatrainer02 Dialgatrainer02 changed the title inconsisten final plan inconsistent final plan Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
Status: 📥 Inbox
Development

No branches or pull requests

1 participant