Skip to content
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 case for plugin_cache_may_break_dependency_lock_file #36201

Open
Porter opened this issue Dec 11, 2024 · 1 comment
Open

Use case for plugin_cache_may_break_dependency_lock_file #36201

Porter opened this issue Dec 11, 2024 · 1 comment
Labels
enhancement new new issue not yet triaged

Comments

@Porter
Copy link

Porter commented Dec 11, 2024

Terraform Version

N/A, versions with the plugin provider cache

Use Cases

The plugin_cache_may_break_dependency_lock_file documentation states "If your workflow relies on the use of this option, please open a GitHub issue to share details about your situation..."

I have such a use case, and here are the details:

We essentially host Terraform as a Service, meaning clients send their terraform modules to us, and we'll continuously run tf plan and tf apply on the those modules.

Due to security requirements, every terraform command for a given module runs in an isolated container (gvisor). To save time/bandwidth, there is one terraform plugin cache dir per service. Each gvisor instance is given access to this dir.

Also note the gvisor containers are not kept around. When it's time to either plan or apply, a new gvisor container is created, the terraform module is loaded into it, the plugin cache dir is exposed via symlink/mounting (I'm not which one, but I don't think it matters), then tf init and then either plan or apply is executed in the gvisor container.

Since every time running tf init is the always the first time tf init is run in the container, there is no dependency lock file, so terraform will not use any providers from the cache.

Attempted Solutions

By setting plugin_cache_may_break_dependency_lock_file, terraform will use the providers in the cache.

An alternative approach for us would be to extract the dependency lock file from a container after it finishes tf init and use that, but this may be tricky, especially since we may have multiple gvisor containers running at once.

Proposal

No response

References

@Porter Porter added enhancement new new issue not yet triaged labels Dec 11, 2024
@crw
Copy link
Contributor

crw commented Dec 12, 2024

Thanks for this feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants