onelogin / terraform-provider-onelogin

GNU General Public License v3.0
27 stars 19 forks source link

Support new directory structure of Terraform v0.13.x in make sideload task #22

Closed szemek closed 3 years ago

szemek commented 3 years ago

Terraform v0.13.x introduces new directory structure for plugins

https://www.hashicorp.com/blog/automatic-installation-of-third-party-providers-with-terraform-0-13

Terraform needs a way to tell providers on disk apart— binary name is no longer sufficient—so we've created a new directory hierarchy that Terraform can use to precisely determine the source address of each provider it finds on disk:

$PLUGIN_DIRECTORY/$SOURCEHOSTNAME/$SOURCENAMESPACE/$NAME/$VERSION/$OS_$ARCH/

This pull request introduces changes to make sideload task. It copies a binary to three locations: the old one and two new ones for different architectures. I didn't introduce any extra logic to detect version of Terraform or operating system.

dcaponi commented 3 years ago

Sorry for leaving this one out for so long. Question: How does it know when I run make sideload if I'm using version 12 or 13? It looks like it creates file structures for both versions regardless right? I haven't had a chance to test this but I don't think it'll break anything.

szemek commented 3 years ago

@dcaponi yes, it creates 3 copies of binary in total. One for 0.12.x and two for 0.13.x (one for darwin_amd64 architecture, one for linux_amd64 architecture). Approach is very naive, it doesn't break existing behaviour, but it adds 2 extra copies of binary for 0.13.x.