How to use two providers having the same name in the same project?

It’s probably a rare case, but in most language we have namespace to handle name conflict.

I have these two providers I want to use in the same project:

    proxmox = {
      source = "blz-ea/proxmox"
      version = "0.3.3"
    }
    proxmox = {
      source = "Telmate/proxmox"
      version = "2.9.13"
    }

Is this possible? How?

It’s doable, but a bit cumbersome.

terraform {
  required_providers {
    proxmox = {
      source  = "blz-ea/proxmox"
      version = "0.3.3"
    }
    telmate = {
      source  = "Telmate/proxmox"
      version = "2.9.13"
    }
  }
}

resource "proxmox_lxc" "foo" {
  provider = telmate
  ...
}

You have to manually include a provider = ... line in every resource or data block using the provider that you choose to use via an aliased name.

3 Likes

@maxb It’s working! Thanks.

Could alias be also used with a separate provider stanza?

No, because provider aliases give you multiple instances of one provider, not a way to manage two different providers.