appgate / sdp-tf-reference-architecture

Example reference architecture for Appgate deployment on AWS.
MIT License
5 stars 3 forks source link

Error: Failed to query available provider packages #1

Closed drewmullen closed 3 years ago

drewmullen commented 3 years ago

Error:

$ tf init

Initializing the backend...

Initializing provider plugins...
- Finding latest version of appgate.com/appgate/appgate...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
appgate.com/appgate/appgate: cannot search $HOME/.terraform.d/plugins: lstat
$HOME/.terraform.d/plugins: no such file or directory

Config & main.tf

$ cat $TF_CLI_CONFIG_FILE
provider_installation {
  filesystem_mirror {
    path    = "$HOME/.terraform.d/plugins"
    include = ["appgate.com/*/*"]
  }
  direct {
    exclude = ["appgate.com/*/*"]
  }
}

$ file ~/.terraform.d/plugins/appgate.com/appgate/0.3.3/darwin_amd64/terraform-provider-appgate
/Users/drmullen/.terraform.d/plugins/appgate.com/appgate/0.3.3/darwin_amd64/terraform-provider-appgate: Mach-O 64-bit executable x86_64

$ cat main.tf
terraform {
  required_providers {
    appgate = {
      source = "appgate.com/appgate/appgate"
      # version = "0.3.3"
    }
  }
}

It possible I am missing something easy, I've never manually pointed to a provider like this

drewmullen commented 3 years ago

original post https://github.com/appgate/sdp-terraform-provider/issues/86

dlnilsson commented 3 years ago

What terraform version are you using? I know they have changed the behaviour of loading custom providers between versions, so it might differ.

In your example, I believe its that dev.tfrc cant resolve $HOME, that you need to use absoulute path

provider_installation {
  filesystem_mirror {
    path    = /Users/drmullen/.terraform.d/plugins"
    include = ["appgate.com/*/*"]
  }
  direct {
    exclude = ["appgate.com/*/*"]
  }
}
$ file ~/.terraform.d/plugins/appgate.com/appgate/0.3.3/darwin_amd64/terraform-provider-appgate

I believe this should be 1 more subdir,

< ~/.terraform.d/plugins/appgate.com/appgate/0.3.3/darwin_amd64/terraform-provider-appgate
---
> ~/.terraform.d/plugins/appgate.com/appgate/appgate/0.3.3/darwin_amd64/terraform-provider-appgate

for older versions, for example Terraform v0.12.30 you need to update the code to

terraform {
  required_providers {
    appgate = {
      version = ">= 0.3.3"
    }
  }
}

and move the provider binary to $HOME/.terraform.d/plugins with the name terraform-provider-appgate_v0.3.3 for example

/home/dln/.terraform.d/plugins/terraform-provider-appgate_v0.3.3
drewmullen commented 3 years ago

fml. it was the 2nd appgate. my apologies. the $HOME does work though, so thats a +

seems like youre working pretty hard on this recently; ill try to give you feedback where possible

thanks