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

terraform/module: Introduce new job to parse provider versions from lock file #992

Closed
4 tasks
radeksimko opened this issue Jul 6, 2022 · 1 comment · Fixed by #1014
Closed
4 tasks
Assignees
Labels
enhancement New feature or request modules Functionality related to the module block and modules generally
Milestone

Comments

@radeksimko
Copy link
Member

radeksimko commented Jul 6, 2022

Background

Currently we treat provider lock file (and installed provider binaries) as opaque and only use them in the watcher to know whether they have changed, to re-run terraform version and terraform providers schema -json to refresh provider versions and obtain new schemas.

The scheduler already de-duplicates jobs (including the two mentioned above), such that we never run the same job for the same folder more than once, if it's already in the queue. This is a good barrier, but we anticipate the following features to put more pressure on the scheduler and create more situations of duplicate work (same job for the same folder) scheduled more sparsely, which the scheduler itself has no chance of catching.

both of which increase the chance of us scheduling the same jobs for the same directory repeatedly.

The root problem is that we don't know if we need the schema before we run these commands and so we potentially waste CPU and IO on both jobs unless they end up deduplicated within the same job queue.

There are different ways that Terraform persists the installed provider versions between TF versions:

var pluginLockFilePathElements = [][]string{
// Terraform >= 0.14
{".terraform.lock.hcl"},
// Terraform >= v0.13
{DataDirName, "plugins", "selections.json"},
// Terraform >= v0.12
{DataDirName, "plugins", runtime.GOOS + "_" + runtime.GOARCH, "lock.json"},
}

While relying on more of Terraform's internal state is not great, the cost/risk seems well out-weighted by our ability to prevent wasteful CLI commands if we know that we already have the same provider schema for the same version already available in memdb cache.

Proposal

@github-actions
Copy link

github-actions bot commented Sep 4, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request modules Functionality related to the module block and modules generally
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant