Skip to content

Commit

Permalink
Merge pull request #105 from signalsciences/siterule-requestlogging-r…
Browse files Browse the repository at this point in the history
…emove-default

remove requestlogging default from site rule resource
  • Loading branch information
shawnps authored Jan 23, 2023
2 parents 435334c + f31b96e commit 4bf1358
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 0 additions & 1 deletion provider/resource_site_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func resourceSiteRule() *schema.Resource {
Type: schema.TypeString,
Description: "Indicates whether to store the logs for requests that match the rule's conditions (sampled) or not store them (none). This field is only available for request rules that have a block or allow action.",
Optional: true,
Default: "sampled",
},
"actions": {
Type: schema.TypeSet,
Expand Down
18 changes: 13 additions & 5 deletions provider/resource_site_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,12 @@ func TestACCResourceSiteRuleConditionSignal(t *testing.T) {
{
Config: fmt.Sprintf(`
resource "sigsci_site_rule" "test" {
site_short_name = "%s"
site_short_name = "%s"
type = "request"
group_operator = "all"
enabled = true
reason = "Example site rule update"
requestlogging = "sampled"
expiration = ""
conditions {
Expand Down Expand Up @@ -272,6 +273,7 @@ func TestACCResourceSiteRuleConditionSignal(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "conditions.2455721190.conditions.3887678098.conditions.#", "1"),
resource.TestCheckResourceAttr(resourceName, "conditions.1840769124.conditions.#", "1"),
resource.TestCheckResourceAttr(resourceName, "conditions.2455721190.conditions.2522856064.conditions.#", "3"),
resource.TestCheckResourceAttr(resourceName, "requestlogging", "sampled"),
),
},
{
Expand All @@ -296,7 +298,7 @@ func TestACCResourceSiteRuleTagSignal(t *testing.T) {
{
Config: fmt.Sprintf(`
resource "sigsci_site_signal_tag" "test_tag" {
site_short_name = "%s"
site_short_name = "%s"
name = "newtag"
description = "test description"
}
Expand All @@ -306,6 +308,7 @@ func TestACCResourceSiteRuleTagSignal(t *testing.T) {
group_operator="all"
enabled= true
reason= "Example site rule update"
requestlogging="sampled"
expiration= ""
conditions {
type="single"
Expand Down Expand Up @@ -356,6 +359,7 @@ func TestACCResourceSiteRuleActions(t *testing.T) {
enabled=true
reason= "Example site rule update"
expiration=""
requestlogging="sampled"
conditions {
type="single"
field="path"
Expand All @@ -381,6 +385,7 @@ func TestACCResourceSiteRuleActions(t *testing.T) {
group_operator="all"
enabled=true
reason="Example site rule update"
requestlogging="sampled"
expiration=""
conditions {
type="single"
Expand All @@ -406,6 +411,7 @@ func TestACCResourceSiteRuleActions(t *testing.T) {
group_operator="all"
enabled=true
reason="Example site rule update"
requestlogging="sampled"
expiration=""
conditions {
type="single"
Expand All @@ -417,7 +423,7 @@ func TestACCResourceSiteRuleActions(t *testing.T) {
type = "block"
response_code = 499
}
}`, testSite),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "actions.#", "1"),
Expand Down Expand Up @@ -453,8 +459,8 @@ func TestACCResourceSiteRuleActionsTypeSwitch(t *testing.T) {
group_operator="all"
enabled=true
reason= "Example site rule update"
requestlogging=""
expiration=""
requestlogging=""
signal="CMDEXE"
conditions {
type="single"
Expand Down Expand Up @@ -482,6 +488,7 @@ func TestACCResourceSiteRuleActionsTypeSwitch(t *testing.T) {
group_operator="all"
enabled=true
reason="Example site rule update"
requestlogging="sampled"
expiration=""
conditions {
type="single"
Expand Down Expand Up @@ -527,6 +534,7 @@ func TestACCResourceSiteRuleInvalidUpdateMaxConditions(t *testing.T) {
group_operator="any"
enabled=true
reason= "Example site rule update"
requestlogging= "sampled"
expiration=""
conditions {
field = "ip"
Expand Down Expand Up @@ -582,7 +590,7 @@ func TestACCResourceSiteRuleInvalidUpdateMaxConditions(t *testing.T) {
type = "single"
value = "1.1.1.9"
}
actions {
type = "block"
}
Expand Down

0 comments on commit 4bf1358

Please sign in to comment.