Provider helm is undefined

Hi all,
I have a problem with provider definition. I get this error (warning):


│ Warning: Provider helm is undefined

│ on cls_blue.tf line 46, in module “mymodule_blue”:
│ 46: helm = helm.blue

│ Module module.mymodule_blue does not declare a provider named helm.
│ If you wish to specify a provider configuration for the module, add an entry for helm in the required_providers block within the module.

but, I have this in versions.tf:

terraform {
  required_providers {
    helm = {
      source                = "hashicorp/helm"
      configuration_aliases = [helm.blue]
    }
  }
}

cls_blue.tf:

provider "helm" {
  alias = "blue"
  kubernetes {
     ....
  }
}

module "mymodule_blue" {
     source = "../_shared/helmsrel"
     ....
     providers = {
      helm = helm.blue
     }
}

Terraform vesion: 1.0.11

Pls help. What I’m doing wrong? Thank you…

The entire contents of the terraform { required_providers { } } block applies to the directory it is specified in only, and not to Terraform modules in child directories elsewhere.

This is actually what you want, since when you write:

you are saying “The helm provider aliased as blue in this current module will be the unaliased default helm provider within the module I am calling here”, meaning if the configuration_aliases setting was inherited, it would be incorrect.

You need to add

terraform {
  required_providers {
    helm = {
      source = "hashicorp/helm"
    }
  }
}

within the ../_shared/helmsrel directory.

1 Like

:astonished: oh… you’re right…

Thank you!