Terraform-bundle package - Failed to read config or no provider exists with the given name

Getting error below when trying to create terraform-bundle package

$ /home/docker/go/bin/terraform-bundle package -os=linux -arch=amd64 terraform-bundle.hcl
Failed to read config: At 9:13: root.providers.azurerm[0]: unknown type for string *ast.ObjectType

My terraform-bundle.hcl below:

terraform {
  version = "0.12.28"
}
providers {
  azurerm = {
    versions = ["2.20.0"]
  }
   random = {
    versions = ["~>2.3"]
  }
  restapi = {
    versions = ["1.14.0"]
    source = "github.com/Mastercard/terraform-provider-restapi"
  }
}

Because it is 12.28 , I changed config to

terraform {
  version = "0.12.28"
}
providers {
  azurerm = ["~>2.20.0"]
   random = ["~>2.3"]
  restapi = ["1.14.0"]
}

and now getting no provider exists with the given name error:

$ /home/docker/go/bin/terraform-bundle package -os=linux -arch=amd64 -plugin-dir=./plugins/github.com/Mastercard/1.14.0/linux_amd64/ terraform-bundle.hcl
Fetching Terraform 0.12.28 core package...
Fetching 3rd party plugins in directory: ./plugins/github.com/Mastercard/1.14.0/linux_amd64/
plugin: restapi-v1.14.0 (0.0.0)
- Resolving "azurerm" provider (~>2.20.0)...
- Checking for provider plugin on https://releases.hashicorp.com...
- Downloading plugin for provider "azurerm" (hashicorp/azurerm) 2.20.0...
- Resolving "random" provider (~>2.3)...
- Checking for provider plugin on https://releases.hashicorp.com...
- Downloading plugin for provider "random" (hashicorp/random) 2.3.0...
- Resolving "restapi" provider (1.14.0)...
- Checking for provider plugin on https://releases.hashicorp.com...
- Failed to resolve restapi provider 1.14.0: no provider exists with the given name

I keep the provider like this:

$ ls plugins/github.com/Mastercard/1.14.0/linux_amd64/terraform-provider-restapi-v1.14.0 
plugins/github.com/Mastercard/1.14.0/linux_amd64/terraform-provider-restapi-v1.14.0

ok, sounds like the answer is here https://www.sqlservercentral.com/blogs/compiling-a-custom-provider-and-including-for-terraform-cloud
r
estapi = ["0.0.0"]

1 Like

Was looking through my search console for some issues and noticed this backlink to original post. I’m stoked that someone benefited from that walk through :clap: and I wasn’t talking into the void :laughing: .

Was an interesting experience!