From c4e5e17b18bd0d02e377cbb444b67421eb7ae6f0 Mon Sep 17 00:00:00 2001 From: Daniel Corbett <38925638+daniel-corbett@users.noreply.github.com> Date: Mon, 19 Jun 2023 23:21:37 -0400 Subject: [PATCH] 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. --- provider/lib.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/provider/lib.go b/provider/lib.go index 8e7d295..8c02b09 100644 --- a/provider/lib.go +++ b/provider/lib.go @@ -2,7 +2,6 @@ package provider import ( "fmt" - "net/http" "sort" "strconv" "strings" @@ -494,11 +493,6 @@ func flattenRuleActions(actions []sigsci.Action, customResponseCode bool) []inte if customResponseCode { // response code is set to 0 by sigsci api when action.type != "block" // for types such as "allow" or "logRequest", response code is irrelevant and hence not provided in API response - // TF assigns default value of 0 which creates an issues when checking TF plan because we set default value of 406 (http.StatusNotAcceptable) - // This noop piece of code ensures tests pass as expected - if action.ResponseCode == 0 { - action.ResponseCode = http.StatusNotAcceptable - } actionMap["response_code"] = action.ResponseCode } actionsMap[i] = actionMap