0
votes

I installed Terraform v1.0.1 on linux_amd64 (Oracle Linux Srv 8.4 64bit).

I’m trying to use a local provider/plugin that I saved in the folder: /root/.terraform.d/plugins

# ll /root/.terraform.d/plugins
drwxr-xr-x. 2 root root       38 Jun 29 15:42 oldversion
-rwxr-xr-x. 1 root root 30068808 Jun 29 15:42 terraform-provider-zabbix
drwxr-xr-x. 2 root root       52 Jun 29 15:42 test_plugging

This is my vim /root/.terraformrc:

provider_installation {
  filesystem_mirror {
    path    = "/root/.terraform.d/plugins"
  }
  direct {
    exclude = ["registry.terraform.io/*/*"]
  }
}

This is my main.tf:

terraform {
    required_version    = ">= 0.12.6"
}
provider "zabbix" {
    username            = local.provider_vars.zabbix.username
    password            = local.provider_vars.zabbix.password
    url                 = local.provider_vars.zabbix.endpoint
    tls_insecure        = true
}

but when I run: terraform init

Initializing the backend...

Initializing provider plugins...

  • Finding latest version of hashicorp/zabbix...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/zabbix: provider registry.terraform.io/hashicorp/zabbix was not found in any of the search locations

  • /root/.terraform.d/plugins

How can fix this problem? Thanks for the help

Marco

1

1 Answers

2
votes

Assuming you have a binary

~/.terraform.d/plugins/terraform.local/local/zabbix/1.0.0/linux_amd64/terraform-provider-zabbix_v1.0.0

Configure Terraform as follows

terraform {
  required_providers {
    zabbix = {
      source  = "terraform.local/local/zabbix"
      version = "1.0.0"
      # Other parameters...
    }
  }
}

Which works as follows

terraform init

Initializing the backend...

Initializing provider plugins...
- Finding terraform.local/local/zabbix versions matching "1.0.0"...
- Installing terraform.local/local/zabbix v1.0.0...
- Installed terraform.local/local/zabbix v1.0.0 (unauthenticated)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!