Horacio Castro
Horacio Castro

Reputation: 3

Terraform provider hashicorp/launch (does not exist)

I´m encountering an issue when initializing my terraform. I receive the following error:

Error: Failed to query available provider packages │ │ Could not retrieve the list of available versions for provider hashicorp/launch: provider registry registry.terraform.io does not have a provider named │ registry.terraform.io/hashicorp/launch │ │ All modules should specify their required_providers so that external consumers will get the correct providers when using a module. To see which modules are currently │ depending on hashicorp/launch, run the following command: │ terraform providers

In this matter, I´m not using any provider nor referencing any "launch" provider different than "hashicorp/aws". The error seems to be inside the eks_nodegroup module, because when I comment this section, I don't receive any errors.

This is my eks_nodegroup module:

resource "aws_eks_node_group" "iac_eks_node_group" {
  cluster_name    = var.eks_cluster_name
  node_group_name = "ibm-mq-nodegroup-iac-1"
  node_role_arn   = "arn:aws:iam::1234512345:role/eks-node-group-role"
  subnet_ids      = ["subnet-1234512345", "subnet-12345678923", "subnet-098765432345"]       

  scaling_config {
    min_size     = 1
    max_size     = 1
    desired_size = 1
  }

  launch_template {
    id      = var.launch_template_id
    version = var.launch_template_version
  }
}

I listed my providers and found this:

module.eks_nodegroups ├── provider[registry.terraform.io/hashicorp/aws] └── provider[registry.terraform.io/hashicorp/launch]

Also, commented all the eks_nodegroup module and worked fine... but I need to create the nodegroup so this does not work. Checked any VPN connections, certs or reference to this provider, that for what I've searched, there is no hashicorp/launch provider.

Please, if anybody has encountered the same issue or know a workaround I would really appreciate some feedback.

Thanks in advance.

Upvotes: 0

Views: 47

Answers (2)

Martin Atkins
Martin Atkins

Reputation: 74594

Although I cannot confirm this with the information you've shared in your question, I expect that somewhere in your eks_nodegroups module you have a declaration like this:

resource "launch_configuration" "example" {
  # ...
}

When a resource block does not have an explicit provider argument, Terraform guesses that the first part of the resource type name ("launch" in this case) is the local provider name to use.

Since there is no entry in your module's required_providers block for the local name "launch", that then activates some backward-compatibility behavior where Terraform guesses that this module was written for Terraform v0.12 (which didn't yet have the possibility of installing providers from anywhere other than HashiCorp's set) and so automatically infers a dependency on hashicorp/launch.

If my guess was correct, and you'd intended to declare an AWS launch configuration, then the correct resource type name to use is aws_launch_configuration, which will then cause Terraform to associate this with the provider whose local name is "aws". If you haven't declared aws in your required_providers block then the backward-compatibility behavior would make Terraform automatically select hashicorp/aws, which is likely correct in this case.

Upvotes: 2

Marko E
Marko E

Reputation: 18203

This usually happens when you forget to add the resource type for a resource. For example, if you are defining the launch template elsewhere in the code, you might have omitted the aws_ part. This doc is not exactly explain the issue, but it shows the naming convention used.

Upvotes: 1

Related Questions