Masking policy state not properly registered with using <<-EOT EOT
notation
#1422
Labels
bug
Used to mark issues with provider's incorrect behavior
category:resource
resource:masking_policy
Issue connected to the snowflake_masking_policy resource
Provider Version
0.51.0
Terraform Version
v1.3.6
Describe the bug
While defining masking policies in Snowflake we decided to store the masking expression in a properly formatted SQL file instead of always placing the masking expression as a one-liner in the configuration. Having a one-liner worked alright in the beginning, but as masking expressions started to grow it became a pain to review, so we placed the masking expression in a SQL file and used the
terraform
file
function (ref) to load the masking expression from the SQL file.With this approach, the definition of the masking expression is defined as something like:
instead of the usual oneliner
"CASE WHEN <some_expression> THEN <masked result> ELSE val END"
.This is expected as it's the notation for terraform to handle multiline strings. Although, while using this approach
terraform
always considers that the masking policies need to be changed even when no code was changed, seeming that this notation is not properly registered in theterraform
state.Expected behavior
terraform plan/apply
to only detect changes when code is actually changed.Code samples and commands
Resource definition example:
./masking_policies/mask_varchar.sql
content:terraform plan
result returned every time, even when no code changes were made:Result of
terraform state show 'snowflake_masking_policy.mask_varchar["nl-prod"]'
Additional context
The behaviour is the same If I paste the masking expression using the
EOT
notation directly into the resource definition instead of using thefile()
function.The text was updated successfully, but these errors were encountered: