Skip to content

Commit

Permalink
GH-130 allow to create ignore rules for both watches and policies
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmkn committed Jul 18, 2023
1 parent 44c6bb5 commit 668d2cf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## 1.14.1 (July 18, 2023)

BUG FIXES:

* resource/xray_ignore_rule: removed restriction, so the ignore rule can be created for both a policy and a watch.

PR: [#]()
Issue: [#130](https://github.com/jfrog/terraform-provider-xray/issues/130)

## 1.14.0 (June 1, 2023). Tested on Artifactory 7.59.9 and Xray 3.74.8

IMPROVEMENTS:
Expand Down
18 changes: 8 additions & 10 deletions pkg/xray/resource_xray_ignore_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,19 @@ func resourceXrayIgnoreRule() *schema.Resource {
},
},
"policies": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Description: "List of specific policies to ignore. Omit to apply to all.",
ConflictsWith: []string{"watches"},
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Description: "List of specific policies to ignore. Omit to apply to all.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"watches": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Description: "List of specific watches to ignore. Omit to apply to all.",
ConflictsWith: []string{"policies"},
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Description: "List of specific watches to ignore. Omit to apply to all.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down
5 changes: 4 additions & 1 deletion pkg/xray/resource_xray_ignore_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestAccIgnoreRule_scopes_policies(t *testing.T) {
})
}

func TestAccIgnoreRule_scopes_watches(t *testing.T) {
func TestAccIgnoreRule_scopes_watches_policies(t *testing.T) {
_, fqrn, name := test.MkNames("ignore-rule-", "xray_ignore_rule")
expirationDate := time.Now().Add(time.Hour * 48)

Expand Down Expand Up @@ -259,6 +259,7 @@ func TestAccIgnoreRule_scopes_watches(t *testing.T) {
expiration_date = "{{ .expirationDate }}"
cves = ["fake-cve"]
watches = [xray_watch.fake_watch.name]
policies = [xray_security_policy.security.name]
}
`, map[string]interface{}{
"name": name,
Expand All @@ -279,6 +280,8 @@ func TestAccIgnoreRule_scopes_watches(t *testing.T) {
resource.TestCheckResourceAttr(fqrn, "is_expired", "false"),
resource.TestCheckResourceAttr(fqrn, "watches.#", "1"),
resource.TestCheckTypeSetElemAttr(fqrn, "watches.*", "fake-watch"),
resource.TestCheckResourceAttr(fqrn, "policies.#", "1"),
resource.TestCheckTypeSetElemAttr(fqrn, "policies.*", "fake-policy"),
),
},
{
Expand Down

0 comments on commit 668d2cf

Please sign in to comment.