Skip to content

Commit

Permalink
data project now checks for empty string on autoscan
Browse files Browse the repository at this point in the history
  • Loading branch information
wrighbr committed Mar 10, 2021
1 parent 1f856ee commit e606685
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type ProjectsBodyResponses struct {
} `json:"cve_allowlist"`
Metadata struct {
EnableContentTrust string `json:"enable_content_trust"`
AutoScan string `json:"auto_scan"`
AutoScan string `json:"auto_scan,omitempty"`
Severity string `json:"severity"`
ReuseSysCveAllowlist string `json:"reuse_sys_cve_allowlist"`
Public string `json:"public"`
Expand Down
13 changes: 10 additions & 3 deletions provider/data_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ func dataProjectRead(d *schema.ResourceData, m interface{}) error {
if err != nil {
return err
}
autoScan, err := strconv.ParseBool(v.Metadata.AutoScan)
if err != nil {
return err

var autoScan bool
scan := v.Metadata.AutoScan
if scan == "" {
autoScan = false
} else {
autoScan, err = strconv.ParseBool(scan)
if err != nil {
return err
}
}

d.SetId(id)
Expand Down

0 comments on commit e606685

Please sign in to comment.