Repair ability to read terraform output from stdin
@@ -18,6 +18,7 @@ package config
import (
"io/ioutil"
+ "os"
"github.com/pkg/errors"
@@ -108,9 +109,12 @@ func LoadKubeOneCluster(clusterCfgPath, tfOutputPath string) (*kubeoneapi.KubeOn
}
var tfOutput []byte
- if len(tfOutputPath) > 0 {
- tfOutput, err = ioutil.ReadFile(tfOutputPath)
- if err != nil {
+ if tfOutputPath == "-" {
+ if tfOutput, err = ioutil.ReadAll(os.Stdin); err != nil {
+ return nil, errors.Wrap(err, "unable to read terraform output from stdin")
+ }
+ } else if len(tfOutputPath) > 0 {
+ if tfOutput, err = ioutil.ReadFile(tfOutputPath); err != nil {
return nil, errors.Wrap(err, "unable to read the given terraform output file")
}
}
