terraform-provider-proxmox icon indicating copy to clipboard operation
terraform-provider-proxmox copied to clipboard

Support provider_override

Open maxexcloo opened this issue 1 year ago • 8 comments

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

maxexcloo avatar May 16 '24 06:05 maxexcloo

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.

bpg avatar May 16 '24 22:05 bpg

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…)

maxexcloo avatar May 16 '24 23:05 maxexcloo

Hi @maxexcloo, have you tried provider aliases?

bpg avatar May 23 '24 02:05 bpg

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).

maxexcloo avatar May 23 '24 02:05 maxexcloo

@bpg curious what you think about this usecase - has it come up before?

maxexcloo avatar Aug 21 '24 01:08 maxexcloo

@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.

bpg avatar Aug 21 '24 01:08 bpg

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 😄

svengreb avatar Aug 26 '24 20:08 svengreb

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 ☀️

maxexcloo avatar Aug 26 '24 23:08 maxexcloo

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.

bpg avatar Jan 18 '25 00:01 bpg