Giter VIP home page Giter VIP logo

Comments (5)

bpg avatar bpg commented on August 9, 2024 2

Adding this type of filtering configuration at the resource level wouldn't be appropriate for the provider. Please keep in mind that the goal of the Terraform/OpenTofu provider is to manage the remote state of the resource in a declarative way. The template defines what state you want the resource to be in, and the provider brings the resource to that defined state by creating or updating it as necessary.

There isn't much room for functionality outside of state management; essentially, everything the provider operates with must be somehow reflected in that resource state. For example, ipv4_addresses is an "output" attribute of the resource, filled by the provider when it reads information back from the VM. When the provider does that, only the remote state is available to it. This means the filter value, like "^(lo|docker|veth).*", must be somehow available in that remote state so it can be read and applied to the values of the ipv4_addresses list. But where to store them on PVE?

Alternative to that would be having the VM interface filters as part of the provider configuration, which is global and available at any time to all resources and datasources. However, it doesn't sound very appealing to me. A resource-specific config leaking out all the way to the global provider settings, it seems more like a hack than a proper fix for the problem.

The solution proposed in the issue description seems like a good option to me. The only improvement I can think of is perhaps implementing some specific filtering functions in the provider to handle those interface lists with less verbosity. However, this is a new API feature, available only in Terraform 1.8+ and not yet supported by OpenToFu. So, it's unlikely to be worked on any time soon.

from terraform-provider-proxmox.

ratiborusx avatar ratiborusx commented on August 9, 2024 1

Actually was thinking about the same functionality just a few days ago. I'm using outputs to show what IPs my VMs received from DHCP so when i saw a few of them showing gazillion of addresses from docker interfaces i was really sad.
Yes, what Proxmox GUI shows is basically enumeration of interfaces which were found by qemu-guest-agent. But i think some kind of filtration should (could?) be implemented on the provider side.
Not sure that i want to use a local module for that, but i'll think about adding something like that in outputs. Thanks for an example, @xoxys :)

from terraform-provider-proxmox.

Dr-Shadow avatar Dr-Shadow commented on August 9, 2024

This list is actually the same as the one returned in the VM summary on Proxmox VE web interface.

image

I'm not sure if this is ideal to filter out the interfaces in the ressource attributes since this could be relevant information depending on the situation.

from terraform-provider-proxmox.

xoxys avatar xoxys commented on August 9, 2024

Users that don't want to filter out anything just don't set a filter. Users that don't care about some interfaces should still have the possibility to opt-in by setting a provider config.

from terraform-provider-proxmox.

xoxys avatar xoxys commented on August 9, 2024

Thanks for your detailed reply. Thats fine Ill just keep using my current local approach then.

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.