This commit is contained in:
James Bardin 2020-12-01 10:42:07 -05:00
parent f521fcca97
commit 6f577abc72
2 changed files with 3 additions and 51 deletions

View File

@ -70,7 +70,7 @@ func (c *ApplyCommand) Run(args []string) int {
return 1
}
if c.Destroy && planFile != nil {
c.Ui.Error(fmt.Sprintf("Destroy can't be called with a plan file."))
c.Ui.Error("Destroy can't be called with a plan file.")
return 1
}
if planFile != nil {
@ -118,7 +118,7 @@ func (c *ApplyCommand) Run(args []string) int {
diags = diags.Append(tfdiags.Sourceless(
tfdiags.Error,
"Failed to read plan from plan file",
fmt.Sprintf("The given plan file does not have a valid backend configuration. This is a bug in the Terraform command that generated this plan file."),
"The given plan file does not have a valid backend configuration. This is a bug in the Terraform command that generated this plan file.",
))
c.showDiagnostics(diags)
return 1
@ -335,7 +335,7 @@ func outputsAsString(state *states.State, modPath addrs.ModuleInstance, includeH
// Output the outputs in alphabetical order
keyLen := 0
ks := make([]string, 0, len(outputs))
for key, _ := range outputs {
for key := range outputs {
ks = append(ks, key)
if len(key) > keyLen {
keyLen = len(key)

View File

@ -4,9 +4,6 @@ import (
"bytes"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
@ -1538,31 +1535,6 @@ output = test
testStateOutput(t, statePath, expected)
}
func testHttpServer(t *testing.T) net.Listener {
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
t.Fatalf("err: %s", err)
}
mux := http.NewServeMux()
mux.HandleFunc("/header", testHttpHandlerHeader)
var server http.Server
server.Handler = mux
go server.Serve(ln)
return ln
}
func testHttpHandlerHeader(w http.ResponseWriter, r *http.Request) {
var url url.URL
url.Scheme = "file"
url.Path = filepath.ToSlash(testFixturePath("init"))
w.Header().Add("X-Terraform-Get", url.String())
w.WriteHeader(200)
}
// applyFixtureSchema returns a schema suitable for processing the
// configuration in testdata/apply . This schema should be
// assigned to a mock provider named "test".
@ -1649,23 +1621,3 @@ foo = "bar"
const applyVarFileJSON = `
{ "foo": "bar" }
`
const testApplyDisableBackupStr = `
ID = bar
Tainted = false
`
const testApplyDisableBackupStateStr = `
ID = bar
Tainted = false
`
const testApplyStateStr = `
ID = bar
Tainted = false
`
const testApplyStateDiffStr = `
ID = bar
Tainted = false
`