// This should never happen as the user would've already hit
// an error earlier prompting them to run init
diags=diags.Append(fmt.Errorf("The provider %s (%q) is not present in the lockfile, despite being used for state store %q. This is a bug in Terraform and should be reported.",
// The "overridden" case is for unusual special situations like
// dev overrides, so we'll explicitly note it in the logs just in
// case we see bug reports with these active and it helps us
// understand why we ended up using the "wrong" plugin.
log.Printf("[DEBUG] StateStore.VerifyDependencySelections: skipping %s because it's overridden by a special configuration setting",providerAddr)
continue
}
varlock*depsfile.ProviderLock
ifdepLocks!=nil{// Should always be true in main code, but unfortunately sometimes not true in old tests that don't fill out arguments completely
lock=depLocks.Provider(providerAddr)
}
iflock==nil{
log.Printf("[TRACE] StateStore.VerifyDependencySelections: provider %s has no lock file entry to satisfy %q",providerAddr,providerreqs.VersionConstraintsString(constraints))
errs=append(errs,fmt.Errorf("provider %s: required by this configuration but no version is selected",providerAddr))
log.Printf("[TRACE] StateStore.VerifyDependencySelections: provider %s has %s to satisfy %q",providerAddr,selectedVersion.String(),providerreqs.VersionConstraintsString(constraints))
if!allowedVersions.Has(selectedVersion){
// The most likely cause of this is that the author of a module
// has changed its constraints, but this could also happen in
// some other unusual situations, such as the user directly
// editing the lock file to record something invalid. We'll
// distinguish those cases here in order to avoid the more
// specific error message potentially being a red herring in
errs=append(errs,fmt.Errorf("provider %s: locked version selection %s doesn't match the updated version constraints %q",providerAddr,selectedVersion.String(),currentConstraints))
default:
errs=append(errs,fmt.Errorf("provider %s: version constraints %q don't match the locked version selection %s",providerAddr,currentConstraints,selectedVersion.String()))
}
}
}
// Return multiple errors in an arbitrary-but-deterministic order.
sort.Slice(errs,func(i,jint)bool{
returnerrs[i].Error()<errs[j].Error()
})
returnerrs
}
// Hash produces a hash value for the receiver that covers:
// 1) the portions of the config that conform to the state_store schema.
// 2) the portions of the config that conform to the provider schema.