diff --git a/agent/hcp/bootstrap/bootstrap.go b/agent/hcp/bootstrap/bootstrap.go index 47410192b429..1c7ae190a36b 100644 --- a/agent/hcp/bootstrap/bootstrap.go +++ b/agent/hcp/bootstrap/bootstrap.go @@ -457,7 +457,7 @@ func loadManagementToken(dir string) (string, error) { bytes, err := os.ReadFile(name) if os.IsNotExist(err) { // A missing management token is not an error, if none was provided by HCP - return "", nil + return "", errors.New("configuration files on disk are incomplete, missing: " + name) } if err != nil { return "", fmt.Errorf("failed to read: %w", err) diff --git a/agent/hcp/bootstrap/bootstrap_test.go b/agent/hcp/bootstrap/bootstrap_test.go index fa3202c4473a..74b57e5f50ab 100644 --- a/agent/hcp/bootstrap/bootstrap_test.go +++ b/agent/hcp/bootstrap/bootstrap_test.go @@ -372,7 +372,7 @@ func Test_loadPersistedBootstrapConfig(t *testing.T) { existingCluster: true, disableManagementToken: true, expect: expect{ - loaded: true, + loaded: false, }, }, "existing cluster no files": { @@ -398,7 +398,7 @@ func Test_loadPersistedBootstrapConfig(t *testing.T) { "new cluster with no token": { disableManagementToken: true, expect: expect{ - loaded: true, + loaded: false, }, }, "new cluster some files": {