Giter VIP home page Giter VIP logo

Comments (2)

ratiborusx avatar ratiborusx commented on August 9, 2024 1

Hey!
Yep, i suspected it won't be an easy solution :D
My case involves 2 possible scenarios:

  • We have several directory separated environments with dedicated state file each. So person who's helping me manage Proxmox created a VMs in the wrong environment and i wanted to move them into a correct one by removing resources in the initial state and importing in the correct one.
  • Second possible scenario is to try to move already existing manually created VMs under terraform management. It so happened that before i wrote a module some people used to create VMs in GUI so they're "unmanaged" now. I don't remember if i tried that yet though but i thought that i could try to use that on VMs created manually from my module's templates.

Overall i don't really need to know clone's source - i just want my imported VMs to stay and not be re-provisioned by terraform plan. Actually, maybe i could use 'lifecycle' argument for that. Something like this:

  lifecycle {
    ignore_changes = [
      clone
    ]
  }

UPD.
Yep, it works. At least there's no detected changes in resource that would force re-provision. It would make impossible to re-provision resource by changing clone source of course but i already had 'clone[0].vm_id' in there actually - i guess in case my template VMs change their vm_id (they receive it dynamically and i sometimes re-create these templates with updated images). So it's no biggie.
I suppose we could close this one if you don't have anything to add, i really enjoy your explanations. It is nice to talk to smart people :)

from terraform-provider-proxmox.

bpg avatar bpg commented on August 9, 2024

This problem is similar to what I was trying to explain in #1134 (comment)
Basically, any information about the clone source (particularly in the case of a full clone) is completely transient and is not stored in the VM. So there is no way to read it back during the import.

But I'm more curious about the actual use case, why you may need to know the clone's source? Are you planning on updating the source and then have those updates automatically reflected in the clone?
Or is it a case of disaster recovery, when you have a previously applied plan, but the state is lost and you're recovering the state?

If the usage scenario is an edge case, then I'd say, manually editing the imported state and/or plan to reconcile them is a viable option.

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.