terraform-provider-snowflake icon indicating copy to clipboard operation
terraform-provider-snowflake copied to clipboard

Cannot delete snowflake_network_policy_attachment resource

Open brandocomando opened this issue 1 year ago • 1 comments

Terraform CLI and Provider Versions

resource "snowflake_network_policy" "policy" { name = "policy" comment = "A policy."

allowed_ip_list = ["192.168.0.100/24"] blocked_ip_list = ["192.168.0.101"] }

resource "snowflake_network_policy_attachment" "attach" { network_policy_name = "policy" set_for_account = true }

Terraform Configuration

Terraform v1.5.5
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v5.37.0
+ provider registry.terraform.io/hashicorp/random v3.6.0
+ provider registry.terraform.io/hashicorp/tls v4.0.5
+ provider registry.terraform.io/snowflake-labs/snowflake v0.86.0

Your version of Terraform is out of date! The latest version
is 1.7.4. You can update by downloading from https://www.terraform.io/downloads.html

Expected Behavior

tf destroy should remove the policy attachment

Actual Behavior

│ Error: error deleting attachment for network policy policy err = error unsetting network policy policy on account err = 001003 (42000): SQL compilation error: │ syntax error line 1 at position 20 unexpected ''NETWORK_POLICY''. │

Steps to Reproduce

  1. terraform apply
  2. terraform destroy

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

Seems like a simple sql error. Not sure what the provider is trying to do, but ALTER ACCOUNT UNSET NETWORK_POLICY seems to work for me. as accountadmin

and yes I am running the tf as accountadmin

brandocomando avatar Mar 02 '24 01:03 brandocomando

We are about to undergo a migration of network policies and I realised we have the same problem. The issue is that in file sdk/parameters.go, ObjectParameterUnset is tagged with ddl:"keyword,single_quotes" but the single_quotes should not be there I believe; I can take over and create a PR for it.

raulbonet avatar Mar 03 '24 10:03 raulbonet

Hey @brandocomando. Can you bump to the newest provider version and check if the problem persists after change #2584?

sfc-gh-asawicki avatar May 15 '24 08:05 sfc-gh-asawicki

I had this issue as well. Bumping to the latest provider version resolved it. Thanks!

kvillar avatar Jun 07 '24 22:06 kvillar

Closing this issue then. @brandocomando please file a new issue if the problem persists in the newest provider version.

sfc-gh-asawicki avatar Jun 10 '24 11:06 sfc-gh-asawicki