Skip to content

Commit

Permalink
Fix project resource import where autoscan is unknown / unset.
Browse files Browse the repository at this point in the history
  • Loading branch information
clook committed Jul 16, 2020
1 parent d9c05fe commit 2bf62f0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions harbor/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,16 @@ func setProjectSchema(data *schema.ResourceData, project *models.Project) error
return err
}

autoScan, err := strconv.ParseBool(project.Metadata.AutoScan)
if err != nil {
return err
}
// prevent errors where auto_scan is unset
if project.Metadata.AutoScan != "" {
autoScan, err := strconv.ParseBool(project.Metadata.AutoScan)
if err != nil {
return err
}

if err := data.Set("vulnerability_scanning", autoScan); err != nil {
return err
if err := data.Set("vulnerability_scanning", autoScan); err != nil {
return err
}
}

public, err := strconv.ParseBool(project.Metadata.Public)
Expand Down

0 comments on commit 2bf62f0

Please sign in to comment.