You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Apply the included incapsula_policy resource, with an empty data block
Run terraform plan. There should be no changes but there are.
Additional factoids
I've done a bit of digging into this, and I believe what's happening is that Terraform is reordering the items in the JSON object so that they're in alphabetical order, and then the code to filter out whitespace changes in resource_policy.go isn't correctly removing the empty data block. It will be the first item in the object, but the code to remove it looks for a comma before it which won't be there when it's the first item in the object.
I'm not sure if it's oldValue or newValue in this block of code causing the issue and my knowledge of how this all works is limited so I may be wrong, but I think this change to move the comma may fix the problem:
A workaround for this is to just remove the empty data block entirely, which then doesn't need replacing and so doesn't show pending whitespace changes.
References
No response
The text was updated successfully, but these errors were encountered:
Confirmation
Terraform and Imperva provider version
Terraform 1.8.3
Imperva provider 3.25.0
Affected resource(s)
incapsula_policy
Terraform configuration files
Debug output
I've skipped the debug output as it's too verbose and may contain sensitive information, but I found this in the trace output:
module.pinot_decanter_com_imperva.incapsula_policy.policy will be updated in-place
~ resource "incapsula_policy" "policy" {
id = "REDACTED"
name = "WAF Policy"
~ policy_settings = jsonencode( # whitespace changes
[
{
data = {}
policySettingType = "REMOTE_FILE_INCLUSION"
settingsAction = "ALERT"
},
{
data = {}
policySettingType = "SQL_INJECTION"
settingsAction = "ALERT"
},
{
data = {}
policySettingType = "ILLEGAL_RESOURCE_ACCESS"
settingsAction = "ALERT"
},
{
data = {}
policySettingType = "CROSS_SITE_SCRIPTING"
settingsAction = "ALERT"
},
]
)
# (4 unchanged attributes hidden)
}
Steps to reproduce
data
blockterraform plan
. There should be no changes but there are.Additional factoids
I've done a bit of digging into this, and I believe what's happening is that Terraform is reordering the items in the JSON object so that they're in alphabetical order, and then the code to filter out whitespace changes in resource_policy.go isn't correctly removing the empty data block. It will be the first item in the object, but the code to remove it looks for a comma before it which won't be there when it's the first item in the object.
I'm not sure if it's oldValue or newValue in this block of code causing the issue and my knowledge of how this all works is limited so I may be wrong, but I think this change to move the comma may fix the problem:
to
A workaround for this is to just remove the empty data block entirely, which then doesn't need replacing and so doesn't show pending whitespace changes.
References
No response
The text was updated successfully, but these errors were encountered: