terraformer icon indicating copy to clipboard operation
terraformer copied to clipboard

Install instructions with respect to $HOME/.terraform.d/plugins/ or $HOME/.terraform.d/plugins-cache/

Open techdragon opened this issue 6 years ago • 16 comments

At the moment the install instructions dont mention that you have to create a throwaway terraform directory, put files referencing the provider you intend to use, then execute terraform init, all to just put some files in the plugin directory $HOME/.terraform.d/plugins/.

I realise this is mostly the terraform developers fault for not properly solving https://github.com/hashicorp/terraform/issues/15801 but following the install instructions for using a package manager basically dumped me strait down a rabbit hole and nerd sniped me. To help protect future nerds from getting sniped and wasting an hour fruitlessly searching for a solution it would be good to document/warn users here.

TLDR: It would be good to document this requirement, provide a workaround if possible, and perhaps explain that a proper solution is at the mercy of Hashicorp perhaps linking to the closed issue that didn't actually get solved. https://github.com/hashicorp/terraform/issues/15801

P.S. If this comes across as snarky, I apologise. The way that the linked issue ticket was handled got under my skin after spending an hour hunting for solutions, so I've done my best to share evidence of my frustrations as the example why this should be fixed without using language that is too loaded, but its a fine art at times. 😅

Edit: After running into a bug unrelated to this, I went to look at installing from source to get the fixes and I just discovered the install from source documentation covers most of this issue 🤦‍♂ Its probably worth rearranging the docs a bit so that people reading the package manager docs cant miss it like I did.

techdragon avatar Mar 13 '20 10:03 techdragon

Thanks for raising the issue. Looking at the tool from developer’s perspective is a little bit different... I agree, that’s a good idea to rearrange the documentation. Along with that it would be great to split the documentation of the supported resources from the rest of readme. In its current form, with everything in one big blob, it’s hard to find anything.

patrykorwat avatar Mar 13 '20 13:03 patrykorwat

I've just installed Terraformer from releases (Linux) with the provided four line snippet. When running against AWS I receive the following message.

2020/04/08 14:38:27 open /home/user/.terraform.d/plugins/linux_amd64: no such file or directory

The README doesn't make it clear that I have to go through step 4 of the installation From source after the running the snippet in the From Releases section. If you allow me, I'd be happy to update the documentation in a PR.

GaramNick avatar Apr 08 '20 12:04 GaramNick

@GaramNick Yup. Even I faced the same issue with plugins. Had to install using init.tf to solve the problem. README might need to be updated.

tvvignesh avatar May 24 '20 14:05 tvvignesh

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 04 '21 03:04 github-actions[bot]

not stale

techdragon avatar Apr 06 '21 02:04 techdragon

Not stale!!

AshootoshSharma avatar May 12 '21 13:05 AshootoshSharma

Same here and still haven't figured out what I have to do:

$ terraformer google list
2021/05/17 14:58:42 unknown command "google" for ""
$ terraformer list google
2021/05/17 14:58:50 unknown command "list" for ""
$ terraformer google import --help
2021/05/17 14:59:31 unknown command "google" for ""

Do I need to have terraform installed? If so, this should probs be stated in the README.
I installed terraformer via homebrew - what else do I have to do now? Do I have to put one of these somewhere? Do I have to add a versions.tf and terraform init? (and why?)

Also, if terraform is a prerequisite the brew formula should have it as dependency :)

/edit: for others landing here I have installed terraform, added a versions.tf with my provider gcp

terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
    }
  }
  required_version = ">= 0.13"
}

and ran terraform init. It seems like there isn't actually a list command (as given in the README).
I also had to gcloud auth application-default login to provide ADCs.

/edit2:

Quick suggestion for the install section:

Steps

  1. install terraform (link to terraform.io)
  2. install terraformer (links 'from sources' & 'package managers')
  3. initialize
  4. test

Where initialize has the required information for

  • versions.tf + terraform init
  • authentication stuff (e.g. ADC or service account key file for gcp)

black-snow avatar May 17 '21 13:05 black-snow

There are a number of issues that have gone stale, regarding failure to correctly discover plugins, and the issue has been complicated by the addition of newer versions of terraform not using the .terraform.d/plugins/ folder, in fact they can break if you use that folder wrong. The recommended plugin-cache location should be searched in addition to the currently searched paths. https://www.terraform.io/docs/cli/config/config-file.html#provider-plugin-cache

  • https://github.com/GoogleCloudPlatform/terraformer/issues/579
  • https://github.com/GoogleCloudPlatform/terraformer/issues/590
  • https://github.com/GoogleCloudPlatform/terraformer/issues/592
  • https://github.com/GoogleCloudPlatform/terraformer/pull/608 ( Still has people commenting on it with issues )

techdragon avatar Jul 08 '21 07:07 techdragon

Here's my procedure for getting terraform to populate the plugins cache so that terraformer can find it:

echo 'plugin_cache_dir = "$HOME/.terraform.d/plugins"' >> ~/.terraformrc
mkdir -p ~/.terraform.d/plugins

Since terraform caches the plugins by default in the .terraform subdirectory of the project root, rename or delete this directory so that the plugins need to be reinstalled. Finally

terraform init

maresb avatar Aug 30 '21 20:08 maresb

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 30 '21 01:10 github-actions[bot]

Not stale, still have this issue with tf 0.14 and terraformer v0.8.18

loki-dv avatar Nov 03 '21 06:11 loki-dv

Definitely not stale, so bumping

TheDroker avatar May 17 '22 14:05 TheDroker

bumping yet again, this issue still persists

r614 avatar Jun 07 '22 23:06 r614

help same issue!

joshua-bell-sonrai avatar Jun 22 '22 18:06 joshua-bell-sonrai

This problem will still arise now OS: Linux64 terraform: v1.2.3 terraformer: v0.8.21

freeeverett avatar Jun 29 '22 09:06 freeeverett

Same issue on Windows. Terraform init did not fix.

M322458 avatar Aug 08 '22 20:08 M322458

any update on this? same error on windows

tomgrowflow avatar Sep 23 '22 14:09 tomgrowflow

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Feb 10 '24 01:02 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Feb 19 '24 01:02 github-actions[bot]

the issue is still there. the fix that worked for me was:

  1. initiating a new terraform project ('temp_project') for the cloud provider i need with 'terraform init' (in my case google)
  2. cp temp_project/.terraform/providers/registry.terraform.io/hashicorp/google/5.20.0/linux_amd64/* ~/.terraform.d/plugins/linux_amd64/
  3. chmod 644 ~/.terraform.d/plugins/linux_amd64/terraform-provider-google_v5.20.0_x5

chris-the-wiz avatar Mar 19 '24 21:03 chris-the-wiz