Address remarks

main
Christopher Bowman 2021-11-15 09:07:22 -05:00
parent 6c2f9653e1
commit 8ba05f995b
4 changed files with 5 additions and 10 deletions

View File

@ -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",
)

View File

@ -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 {

View File

@ -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

View File

@ -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