Giter VIP home page Giter VIP logo

Comments (2)

bpg avatar bpg commented on August 9, 2024

It looks like the unprivileged attribute is not imported.

❯ tofu import proxmox_virtual_environment_container.test_container pve/100
proxmox_virtual_environment_container.test_container: Importing from ID "pve/100"...
proxmox_virtual_environment_container.test_container: Import prepared!
  Prepared proxmox_virtual_environment_container for import
proxmox_virtual_environment_container.test_container: Refreshing state... [id=100]

Import successful!

The resources that were imported are shown above. These resources are now in
your OpenTofu state and will henceforth be managed by OpenTofu.

❯ tofu state show proxmox_virtual_environment_container.test_container
# proxmox_virtual_environment_container.test_container:.test_container 
resource "proxmox_virtual_environment_container" "test_container" {
    id        = "100"
    node_name = "pve"
    started   = true
    tags      = []
    template  = false

    disk {
        datastore_id = "local-lvm"
        size         = 8
    }

    initialization {
        hostname = "test"
    }

    network_interface {
        bridge      = "vmbr0"
        enabled     = true
        firewall    = true
        mac_address = "BC:24:11:A9:5C:E2"
        mtu         = 0
        name        = "vmbr0"
        rate_limit  = 0
        vlan_id     = 0
    }

    operating_system {
        type = "ubuntu"
    }
}

unprivileged = false by default, so that's explainable.

But I'm not sure why the import block behaves differently:

❯ tofu plan -generate-config-out=plan.tf
proxmox_virtual_environment_container.test_container: Preparing import... [id=pve/100]
proxmox_virtual_environment_container.test_container: Refreshing state... [id=100]

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

OpenTofu will perform the following actions:

  # proxmox_virtual_environment_container.test_container must be replaced
  # (imported from "pve/100")
  # Warning: this will destroy the imported resource
-/+ resource "proxmox_virtual_environment_container" "test_container" {
      ~ id             = "100" -> (known after apply)
        node_name      = "pve"
      + start_on_boot  = true
        started        = true
      - tags           = [] -> null
        template       = false
      + timeout_clone  = 1800
      + timeout_create = 1800
      + timeout_delete = 60
      + timeout_start  = 300
      + timeout_update = 1800
      + unprivileged   = false # forces replacement
      + vm_id          = (known after apply)

      - disk { # forces replacement
          - datastore_id = "local-lvm" -> null # forces replacement
          - size         = 8 -> null # forces replacement
        }

      - initialization {
          - hostname = "test" -> null
        }

      - network_interface {
          - bridge      = "vmbr0" -> null
          - enabled     = true -> null
          - firewall    = true -> null
          - mac_address = "BC:24:11:A9:5C:E2" -> null
          - mtu         = 0 -> null
          - name        = "vmbr0" -> null
          - rate_limit  = 0 -> null
          - vlan_id     = 0 -> null
        }

      - operating_system { # forces replacement
          - type = "ubuntu" -> null
        }
    }

Plan: 1 to import, 1 to add, 0 to change, 1 to destroy.

Regardless, the import is incomplete. For example, the operating_system block is missing the template_file_id attribute, which is mandatory, while it technically shouldn't be. And I guess there are other discrepancies.

Import is not something that I use often, so this functionality might be half-baked.

from terraform-provider-proxmox.

lingfish avatar lingfish commented on August 9, 2024

Thanks for your attention here, appreciate it.

My current use case is to migrate most/all of my infra to TF/Tofu, previously all created manually. I was hoping for a quicker/smoother/easier transition than basically bit-by-bit building tf files.

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.