-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use provider plugins directly from plugin dir / allow junctions in .terraform #26141
Comments
Hi @c33s, I understand the need to have a configurable location for provider storage, but I'm not sure what you're missing from the current implementations. I assume the filesystem_mirror is what you're looking for (which has some default locations), and there are other options under the Provider Installation section of the configuration docs if that does not suffice. Is there a problem using the |
@jbardin i hope this time my explanation of the problem is better: lets assume we have a project with the following code in the directory
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.20.1"
}
}
}
provider "hcloud" {
token = "${var.hcloud_token}"
version = "1.20.1"
} and the following code in plugin_cache_dir = "$APPDATA/terraform.d/plugin-cache" in terraform 0.11 and 0.12 running
if i move with terraform 0.13 the behavior has changed. running
if i again move the content from as far as i understand
for my understandings this means if the plugin is not cached already do a "direct" download and the copy it to the project also the name the docs also state that the working directory (project dir) is self-contained, which is exactly what we don't want,
as described above we tried to manually link the shared directory to the project diretory
but this leads to
but we don't want to install "from" shared plugin dir we would like to "use" them from the shared plugin dir. we tried to link at multiple depths:
every depth doesn't work only what we would need would be another option like i hope my expanation was clearer this time. |
Thanks for the clarification @c33s, I see what you are trying to do now. It is my understanding that we cannot use junctions directly in terraform due to the default behaviors of windows resulting in the accidental deleting of the binaries along with temporary directories. Terraform will attempt to make a symlink of the provider, and when that's not possible it will copy the provider into the working location. There are no current plans to change this behavior, and the recommended method to prevent the copy would be to provide the user with the correct permissions to create a symlink. It's not entirely clear why manually linking the directories did not work however, and that could be looked into. |
@jbardin directory junctions are quite safe to use, if you delete a junction the original directory is not touched (keywords are junction and directory here). real symlinks need the akward permission set by the admin or needs you to work as admin (both are security issues (something only needs a special explicit allowed permission if you can do something bad with it. you need no extra permission for a directory junction)). i don't know the behavior in "go" but in "php" you have to use also why the copy at all it the files are already in the shared dir? this is also a space problem. if you have a very fast ssd, it's often quite expensive and therefore quite small, so it's also a space problem if everything is duplicated instead of using it from a single location. is it such a huge loss if you delete the plugin binaries by mistake (should it ever happen)? as they can easily be recovered from the registry. it's like deleting the vendor dir in php or the node_modules dir in javascript. not changing the behavior to the old one means a real security impact as
from my point of view, only because nobody (not many people) care about security, this should still be handled as security issue, even if nobody cares and simply work as admin, disable a firewall or grant higher permissions without even knowing the sideeffects. you as tool provider for operations which handle many many server should care about security and allow hardend systems. shouldn't it be your responsibiility to provide such a security allowing tool even if most of the people don't use the security feature? |
I too am trying to use the filesystem_mirror feature in .terraformrc on a Ubuntu system and it keeps creating hard links in the project folder instead of symlinks. How do I get it to create symlinks to reduce the size of our repo? |
using |
in past terraform versions (0.11.?) terraform downloaded the plugins into the working directory but if they were manually moved to
Roaming/terraform.d/plugins
aterraform init
orterraform plan
ran successfull by using the "globally installed plugins.with terraform 0.13.2 (or maybe even 0.12.x) this possibility is gone, the plugins are always copied to
.terraform/plugins
in the working directory.according the issue #16262 this behavior is intended.
@apparentlymart #16262 (comment)
feature request: please bring back the old behavior where having the plugin in the
Roaming/terraform.d/plugins
directory is directly used.the reason i also raised this as bug and security issue is that we use very strict firewall rules. so each plugin has it's own firewall rules. the firewall is best handled if the plugins doesn't change their name (
terraform-provider-external.exe
no version string attached) in this case the firewall would only ask if it was ok that the hash changed for the file and automatically applies the old rules for the new file. of course this is not possible with terraform as it has to keep different versions in parallel.it's ok to manage the rules for each plugin in each version once but now as the plugins are copied to a new location they are "new" files for the firewall which need their own rules. so now it's one rule for each plugin version for each project which is really a lot of overhead.
our workaround in such cases is to use a junction on windows (kind of symlinks which does not require the special admin privilege) but symlinking (junction) is also prevented by terraform:
why? 😢
so the only thing is left to lower the config overhead is that we would have to disable the firewall for the whole outgoing traffic. this is not an option.
can you please bring back the old behavior or at least allow us to use directory junctions? hardlinks are not an option as they don't work accross different partitions and symlinks are also quite unhandy as they require a special permission to be created.
The text was updated successfully, but these errors were encountered: