Skip to content

Commit 32c662f

Browse files
committed
fix: Disable Terraform plugin cache on Darwin
It was occasionally failing without any clear indication of what to fix on our side. The plugins weren't being found by Terraform. We already disable this on Windows, so figured it's fine on Darwin too considering most production deployments will be Linux.
1 parent 94ab6f3 commit 32c662f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

provisioner/terraform/provision.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bufio"
55
"context"
66
"encoding/json"
7+
"errors"
78
"fmt"
89
"io"
910
"os"
@@ -88,9 +89,9 @@ func (t *terraform) Provision(stream proto.DRPCProvisioner_ProvisionStream) erro
8889
})
8990
}
9091
}()
91-
// Windows doesn't work with a plugin cache directory.
92-
// The cause is unknown, but it should work.
93-
if t.cachePath != "" && runtime.GOOS != "windows" {
92+
// Only Linux reliably works with the Terraform plugin
93+
// cache directory. It's unknown why this is.
94+
if t.cachePath != "" && runtime.GOOS == "linux" {
9495
err = terraform.SetEnv(map[string]string{
9596
"TF_PLUGIN_CACHE_DIR": t.cachePath,
9697
})
@@ -229,6 +230,9 @@ func (t *terraform) Provision(stream proto.DRPCProvisioner_ProvisionStream) erro
229230
},
230231
})
231232
}
233+
if errors.Is(err, &exec.ExitError{}) {
234+
// Logs will indicate this anyways.
235+
}
232236
return xerrors.Errorf("plan terraform: %w", err)
233237
}
234238
errorMessage := err.Error()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy