Giter VIP home page Giter VIP logo

Comments (11)

bpg avatar bpg commented on August 9, 2024

I'm not quite sure what's going on here. The log does not match the description of the use case.

According to the log, Terraform is trying to delete four resources simultaneously: containers 101, 103, and 104, and VM 105.

Are they all provisioned on the same datastore, Data_Pool? What type of datastore is it? Do you see any significant spikes in the IO delay metrics on the node?
Do you see anything suspicious in the syslog?

You can also try using parallelism=1 to update one resource at a time and see if it reduces contention.

from terraform-provider-proxmox.

micsport13 avatar micsport13 commented on August 9, 2024

It's a ZFS pool. I'll have to take a look at see if that's what's happening. Is it documented anywhere about what forces a container recreation?

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

You can run terraform plan first, it will explain what operations terraform is going to perform, and if there is any resource re-creating then which attribute changes triggered it.

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

Also, take a look at #995, there are some interesting bits. If IO is a bottleneck you may get better performance by tweaking VM storage / interface types. I noticed you're using a mix of scsi and virio in your VMs.

from terraform-provider-proxmox.

micsport13 avatar micsport13 commented on August 9, 2024

Still no luck. Tried it with parallelism and don't see any spikes in the IO logs. Is there a specific set of logs that I can look at that might help me find the problem?

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

"context deadline exceeded" is a suspicious error tho. Usually it occurs when there is some connectivity issues between client and server. Are the PVE node and the host where you're running terraform from on the same network?

from terraform-provider-proxmox.

micsport13 avatar micsport13 commented on August 9, 2024

Yes, but what's odd is that I can modify resources just fine. It's just the destroy and recreate that is failing.

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

Could you run just terraform plan for your resources, and post the output here?

from terraform-provider-proxmox.

micsport13 avatar micsport13 commented on August 9, 2024

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # proxmox_virtual_environment_container.mariadb must be replaced
-/+ resource "proxmox_virtual_environment_container" "mariadb" {
      ~ id             = "103" -> (known after apply)
      + start_on_boot  = true
        tags           = []
      + timeout_clone  = 1800
      + timeout_create = 1800
      + timeout_delete = 60
      + timeout_start  = 300
      + timeout_update = 1800
      + unprivileged   = true # forces replacement
      + vm_id          = 103
        # (4 unchanged attributes hidden)

      ~ initialization {
            # (1 unchanged attribute hidden)

          - ip_config {
              - ipv4 {
                  - address = "10.0.0.103/24" -> null
                  - gateway = "10.0.0.1" -> null
                }
            }
        }

      ~ operating_system {
          + template_file_id = "local:vztmpl/archlinux-base_2023-06-08-1_amd64.tar.zst" # forces replacement
            # (1 unchanged attribute hidden)
        }

        # (5 unchanged blocks hidden)
    }

  # proxmox_virtual_environment_container.postgres must be replaced
-/+ resource "proxmox_virtual_environment_container" "postgres" {
      ~ id             = "101" -> (known after apply)
      + start_on_boot  = true
        tags           = []
      + timeout_clone  = 1800
      + timeout_create = 1800
      + timeout_delete = 60
      + timeout_start  = 300
      + timeout_update = 1800
      + unprivileged   = true # forces replacement
      + vm_id          = 101
        # (4 unchanged attributes hidden)

      ~ initialization {
            # (1 unchanged attribute hidden)

          - ip_config {
              - ipv4 {
                  - address = "10.0.0.101/24" -> null
                  - gateway = "10.0.0.1" -> null
                }
            }
        }

      ~ operating_system {
          + template_file_id = "local:vztmpl/archlinux-base_2023-06-08-1_amd64.tar.zst" # forces replacement
            # (1 unchanged attribute hidden)
        }

        # (5 unchanged blocks hidden)
    }

  # proxmox_virtual_environment_container.syncthing must be replaced
-/+ resource "proxmox_virtual_environment_container" "syncthing" {
      ~ id             = "104" -> (known after apply)
      + start_on_boot  = true
      ~ tags           = [
          + "arch",
          + "sycnthing",
        ]
      + timeout_clone  = 1800
      + timeout_create = 1800
      + timeout_delete = 60
      + timeout_start  = 300
      + timeout_update = 1800
      + unprivileged   = false # forces replacement
      + vm_id          = 104
        # (4 unchanged attributes hidden)

      ~ operating_system {
          + template_file_id = "local:vztmpl/archlinux-base_2023-06-08-1_amd64.tar.zst" # forces replacement
            # (1 unchanged attribute hidden)
        }

        # (5 unchanged blocks hidden)
    }

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

Ok, the imported state is clearly messed up. I suspect the issue is with timeouts, they were not defined in initial import, and now tf is trying to add them. Which means the current timeout value during apply can be ridiculously small, like a nanosecond, which could explain "content deadline" error.

But regardless, after apply, all your resources are going to be re-created because of discrepancies between the imported state and what is currently defined in the config.
The import functionality of the provider is pretty much untested, as it's not something that I'm actively using. I don't have a good solution for your current situation, except perhaps manually editing the tf state to reconcile it with the current config. Which is not straightforward by any means.

from terraform-provider-proxmox.

micsport13 avatar micsport13 commented on August 9, 2024

If you want, I can at least post an image of the state for one of the containers so if it comes up again, you might have some insight to what the problem might be. I'll just remove them from the state and create them.

resource "proxmox_virtual_environment_container" "postgres" {
    description = null
    id          = "101"
    node_name   = "server"
    started     = false
    tags        = []
    template    = false

    console {
        enabled   = true
        tty_count = 2
        type      = "tty"
    }

    cpu {
        architecture = "amd64"
        cores        = 2
        units        = 1024
    }

    disk {
        datastore_id = "Data_Pool"
        size         = 15
    }

    initialization {
        hostname = "postgres"

        ip_config {
            ipv4 {
                address = "10.0.0.101/24"
                gateway = "10.0.0.1"
            }
        }
    }

    memory {
        dedicated = 512
        swap      = 512
    }

    network_interface {
        bridge      = "vmbr0"
        enabled     = true
        firewall    = true
        mac_address = "<mac_address>"
        mtu         = 0
        name        = "eth0"
        rate_limit  = 0
        vlan_id     = 0
    }

    operating_system {
        template_file_id = null
        type             = "archlinux"
    }
}

from terraform-provider-proxmox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.