add additional warning that providers won't be downloaded
Some checks failed
build / Determine intended Terraform version (push) Has been cancelled
build / Determine Go toolchain version (push) Has been cancelled
Quick Checks / Unit Tests (push) Has been cancelled
Quick Checks / Race Tests (push) Has been cancelled
Quick Checks / End-to-end Tests (push) Has been cancelled
Quick Checks / Code Consistency Checks (push) Has been cancelled
build / Generate release metadata (push) Has been cancelled
build / Build for freebsd_386 (push) Has been cancelled
build / Build for linux_386 (push) Has been cancelled
build / Build for openbsd_386 (push) Has been cancelled
build / Build for windows_386 (push) Has been cancelled
build / Build for darwin_amd64 (push) Has been cancelled
build / Build for freebsd_amd64 (push) Has been cancelled
build / Build for linux_amd64 (push) Has been cancelled
build / Build for openbsd_amd64 (push) Has been cancelled
build / Build for solaris_amd64 (push) Has been cancelled
build / Build for windows_amd64 (push) Has been cancelled
build / Build for freebsd_arm (push) Has been cancelled
build / Build for linux_arm (push) Has been cancelled
build / Build for darwin_arm64 (push) Has been cancelled
build / Build for linux_arm64 (push) Has been cancelled
build / Build for windows_arm64 (push) Has been cancelled
build / Build Docker image for linux_386 (push) Has been cancelled
build / Build Docker image for linux_amd64 (push) Has been cancelled
build / Build Docker image for linux_arm (push) Has been cancelled
build / Build Docker image for linux_arm64 (push) Has been cancelled
build / Build e2etest for linux_386 (push) Has been cancelled
build / Build e2etest for windows_386 (push) Has been cancelled
build / Build e2etest for darwin_amd64 (push) Has been cancelled
build / Build e2etest for linux_amd64 (push) Has been cancelled
build / Build e2etest for windows_amd64 (push) Has been cancelled
build / Build e2etest for linux_arm (push) Has been cancelled
build / Build e2etest for darwin_arm64 (push) Has been cancelled
build / Build e2etest for linux_arm64 (push) Has been cancelled
build / Run e2e test for linux_386 (push) Has been cancelled
build / Run e2e test for windows_386 (push) Has been cancelled
build / Run e2e test for darwin_amd64 (push) Has been cancelled
build / Run e2e test for linux_amd64 (push) Has been cancelled
build / Run e2e test for windows_amd64 (push) Has been cancelled
build / Run e2e test for linux_arm (push) Has been cancelled
build / Run e2e test for linux_arm64 (push) Has been cancelled
build / Run terraform-exec test for linux amd64 (push) Has been cancelled

This commit is contained in:
Daniel Schmidt 2025-11-07 17:04:02 +01:00
parent 1b662d78e5
commit 053738fbf0
2 changed files with 11 additions and 3 deletions

View file

@ -86,13 +86,17 @@ func TestProviderDevOverrides(t *testing.T) {
t.Errorf("stdout doesn't include the warning about development overrides\nwant: %s\n%s", want, got)
}
stdout, stderr, err = tf.Run("init")
stdout, _, _ = tf.Run("init")
if err != nil {
t.Fatalf("unexpected error: %e", err)
}
if got, want := stdout, `Provider development overrides are in effect`; !strings.Contains(got, want) {
t.Errorf("stdout doesn't include the warning about development overrides\nwant: %s\n%s", want, got)
}
if got, want := stdout, "These providers are not installed as part of init since they"; !strings.Contains(got, want) {
t.Errorf("stdout doesn't include init specific warning about consequences of overrides \nwant: %s\n%s", want, got)
}
}
func TestProviderDevOverridesWithProviderToDownload(t *testing.T) {
@ -139,7 +143,7 @@ func TestProviderDevOverridesWithProviderToDownload(t *testing.T) {
tf.AddEnv("TF_CLI_CONFIG_FILE=dev.tfrc")
stdout, stderr, err := tf.Run("providers")
stdout, stderr, _ := tf.Run("providers")
if err != nil {
t.Fatalf("unexpected error: %s\n%s", err, stderr)
}
@ -147,13 +151,16 @@ func TestProviderDevOverridesWithProviderToDownload(t *testing.T) {
t.Errorf("configuration should depend on %s, but doesn't\n%s", want, got)
}
stdout, stderr, err = tf.Run("init")
stdout, _, err = tf.Run("init")
if err != nil {
t.Fatalf("unexpected error: %e", err)
}
if got, want := stdout, `Provider development overrides are in effect`; !strings.Contains(got, want) {
t.Errorf("stdout doesn't include the warning about development overrides\nwant: %s\n%s", want, got)
}
if got, want := stdout, "These providers are not installed as part of init since they were"; !strings.Contains(got, want) {
t.Errorf("stdout doesn't include init specific warning about consequences of overrides \nwant: %s\n got: %s", want, got)
}
// Check if the null provider has been installed
const providerVersion = "3.1.0" // must match the version in the fixture config

View file

@ -177,6 +177,7 @@ func (m *Meta) providerDevOverrideInitWarnings() tfdiags.Diagnostics {
for addr, path := range m.ProviderDevOverrides {
detailMsg.WriteString(fmt.Sprintf(" - %s in %s\n", addr.ForDisplay(), path))
}
detailMsg.WriteString("\nThese providers are not installed as part of init since they were overwritten. If this is unintentional please re-run without the development overrides set.")
return tfdiags.Diagnostics{
tfdiags.Sourceless(
tfdiags.Warning,