terraform-provider-proxmox
terraform-provider-proxmox copied to clipboard
Support provider_override
Is your feature request related to a problem? Please describe. Currently I need to define a provider for each server, I would like to be able to do this on a resource level.
Describe the solution you'd like
Add a provider_override tag into a resource and have that override the provider defaults for that resource, options would be the same as the provider options.
Describe alternatives you've considered Manually creating every provider, leads to a ton of duplication and is quite messy.
Additional context An example is here: https://registry.terraform.io/providers/TelkomIndonesia/linux/latest/docs#provider-override
Hi @maxexcloo! 👋🏼
I'm not quite sure what problem you're trying to solve with this enhancement. Is it about deploying different resources to different nodes in a cluster? If that's the case, the node_name should suffice for the provider. However, you may need to configure additional node name mapping if your node names aren't resolvable in your LAN by DNS (with the default domain).
Regardless of that, the provider expects all nodes in the cluster to have the same authentication configuration for the SSH connection (SSH user, password, or SSH key), and this is unlikely to change.
Let me know if that helps, or if you'd like to discuss this feature further.
Unfortunately as my servers are in different geographic locations I can’t use clusters and as such I need to use a new provider per server currently - as I have many servers this means huge duplication throughout my code (unfortunately Terraform has not supported dynamic providers for several years…)
Hi @maxexcloo, have you tried provider aliases?
I have and they work, unfortunately I can’t use them in a programmatic way and as I have a lot of servers I end up having to manually duplicate everything out (if there were provider overrides it would be a simple for_each).
@bpg curious what you think about this usecase - has it come up before?
@maxexcloo No, this is the first time I'm seeing this use case. However, having a provider config block per resource / datasource would be a significant change.
I guess this will be resolved, or at least as MVP, by OpenTofu with 1.9 through dynamic provider configuration assignments which is also highlighted in the version 1.8 release blog post (because 1.8 finally brought early variable/locals evaluation) This is the number 1 of the top-ranking issues so you @maxexcloo are not alone 😄
I guess this will be resolved, or at least as MVP, by OpenTofu with 1.9 through dynamic provider configuration assignments which is also highlighted in the version 1.8 release blog post (because 1.8 finally brought early variable/locals evaluation) This is the number 1 of the top-ranking issues so you @maxexcloo are not alone 😄
Love to hear this, OpenTofu have been good to me ☀️
OpenTofu 1.9 has been released with support for for_each and dynamic provider variable, see https://opentofu.org/docs/intro/whats-new/#provider-iteration-for_each for more details.