Skip to content

Commit

Permalink
Merge pull request #111 from mxmorin/master
Browse files Browse the repository at this point in the history
Add tag and repo excluding management for retention policies
  • Loading branch information
wrighbr authored Apr 6, 2021
2 parents 4fde64c + 1412d24 commit 7700960
Show file tree
Hide file tree
Showing 3 changed files with 488 additions and 1 deletion.
10 changes: 10 additions & 0 deletions client/retention.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ func expandRententionRules(d *schema.ResourceData) []models.Rules {
tag.Extras = "{\"untagged\":" + strconv.FormatBool(i["untagged_artifacts"].(bool)) + "}"
}

if i["tag_excluding"].(string) != "" {
tag.Decoration = "excludes"
tag.Pattern = i["tag_excluding"].(string)
tag.Extras = "{\"untagged\":" + strconv.FormatBool(i["untagged_artifacts"].(bool)) + "}"
}

scopeSelectorsRepository := models.ScopeSelectors{
Repository: []models.Repository{},
}
Expand All @@ -95,6 +101,10 @@ func expandRententionRules(d *schema.ResourceData) []models.Rules {
repo.Decoration = "repoMatches"
repo.Pattern = i["repo_matching"].(string)
}
if i["repo_excluding"].(string) != "" {
repo.Decoration = "repoMExcludes"
repo.Pattern = i["repo_excluding"].(string)
}

scopeSelectorsRepository.Repository = append(scopeSelectorsRepository.Repository, repo)

Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/BESTSELLER/terraform-provider-harbor

go 1.14

require github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0
require (
github.com/goreleaser/goreleaser v0.162.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0
)
Loading

0 comments on commit 7700960

Please sign in to comment.