Address remarks
parent
6c2f9653e1
commit
8ba05f995b
|
@ -169,8 +169,8 @@ func NewScanCmd(opts *pkg.ScanOptions) *cobra.Command {
|
|||
"Only used with tfstate+tfcloud backend.\n",
|
||||
)
|
||||
fl.StringVar(&opts.BackendOptions.TFCloudAPI,
|
||||
"tfc-api",
|
||||
"",
|
||||
"tfc-endpoint",
|
||||
"https://app.terraform.io/api/v2",
|
||||
"Terraform Cloud / Enterprise API endpoint.\n"+
|
||||
"Only used with tfstate+tfcloud backend.\n",
|
||||
)
|
||||
|
|
|
@ -13,11 +13,11 @@ import (
|
|||
)
|
||||
|
||||
type container struct {
|
||||
Credentials map[string]containerToken `json:"credentials"`
|
||||
Credentials map[string]containerToken
|
||||
}
|
||||
|
||||
type containerToken struct {
|
||||
Token string `json:"token"`
|
||||
Token string
|
||||
}
|
||||
|
||||
type tfCloudConfigReader struct {
|
||||
|
|
|
@ -44,7 +44,7 @@ func TestTFCloudConfigReader_GetToken(t *testing.T) {
|
|||
readerCloser := ioutil.NopCloser(strings.NewReader(tt.src))
|
||||
defer readerCloser.Close()
|
||||
r := NewTFCloudConfigReader(readerCloser)
|
||||
got, err := r.GetToken(`app.terraform.io`)
|
||||
got, err := r.GetToken("app.terraform.io")
|
||||
if err != nil && err.Error() != tt.wantErr.Error() {
|
||||
t.Errorf("GetToken() error = %v, wantErr %v", err, tt.wantErr)
|
||||
return
|
||||
|
|
|
@ -35,11 +35,6 @@ type TFCloudBackend struct {
|
|||
}
|
||||
|
||||
func NewTFCloudReader(client pkghttp.HTTPClient, workspaceId string, opts *Options) (*TFCloudBackend, error) {
|
||||
// Assume if it was not set that the end-point is Terraform Cloud
|
||||
if opts.TFCloudAPI == "" {
|
||||
opts.TFCloudAPI = "https://app.terraform.io/api/v2"
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/workspaces/%s/current-state-version", opts.TFCloudAPI, workspaceId), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue