Skip to content

Commit c4e5e17

Browse files
BUG/MINOR: lib: don't force response code to 406 (#187)
In 4006a6c (BUG/MINOR: do not set default response code) the default to 406 was removed from rules without response codes. However, the provider was still forcing a 406 default behind the scenes causing rules without response codes to be recreated with 406 with every new plan apply. This commit stops forcing the HTTP status code 406 on rules and fixes the issue with rules that have not had changes happen from being recreated.
1 parent 4006a6c commit c4e5e17

File tree

1 file changed

+0
-6
lines changed

1 file changed

+0
-6
lines changed

provider/lib.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package provider
22

33
import (
44
"fmt"
5-
"net/http"
65
"sort"
76
"strconv"
87
"strings"
@@ -494,11 +493,6 @@ func flattenRuleActions(actions []sigsci.Action, customResponseCode bool) []inte
494493
if customResponseCode {
495494
// response code is set to 0 by sigsci api when action.type != "block"
496495
// for types such as "allow" or "logRequest", response code is irrelevant and hence not provided in API response
497-
// TF assigns default value of 0 which creates an issues when checking TF plan because we set default value of 406 (http.StatusNotAcceptable)
498-
// This noop piece of code ensures tests pass as expected
499-
if action.ResponseCode == 0 {
500-
action.ResponseCode = http.StatusNotAcceptable
501-
}
502496
actionMap["response_code"] = action.ResponseCode
503497
}
504498
actionsMap[i] = actionMap

0 commit comments

Comments
 (0)