Skip to content

Commit 23f73b1

Browse files
committed
Update mergeLockedDependencies comment
1 parent b9464b1 commit 23f73b1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

internal/command/meta_dependencies.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,18 @@ func (m *Meta) replaceLockedDependencies(new *depsfile.Locks) tfdiags.Diagnostic
6666
return depsfile.SaveLocksToFile(new, dependencyLockFilename)
6767
}
6868

69-
// mergeLockedDependencies overwrites the existing lock file with a combination of
70-
// the old lock contents and new locks.
69+
// mergeLockedDependencies combines two sets of locks. The 'base' locks are copied, and any providers
70+
// present in the additional locks that aren't present in the base are added to that copy. The merged
71+
// combination is returned.
72+
//
73+
// If you're combining locks derived from config with other locks (from state or deps locks file), then
74+
// the config locks need to be the first argument to ensure that the merged locks contain any
75+
// version constraints. Version constraint data is only present in configuration.
7176
// This allows code in the init command to download providers in separate phases and
7277
// keep the lock file updated accurately after each phase.
7378
//
74-
// Any overlaps between the two sets of locks will be ignored; only new providers will
75-
// be appended.
79+
// This method supports downloading providers in 2 steps, and is used during the second download step and
80+
// while updating the dependency lock file.
7681
func (m *Meta) mergeLockedDependencies(baseLocks, additionalLocks *depsfile.Locks) *depsfile.Locks {
7782

7883
mergedLocks := baseLocks.DeepCopy()

0 commit comments

Comments
 (0)