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

snowflake_object_parameter parsing error

Open gdelia-pm opened this issue 1 year ago • 4 comments

Terraform CLI and Provider Versions

 .\terraform.exe version
Terraform v1.7.3rsi_versi_
on windows_amd64
+ provider registry.terraform.io/snowflake-labs/snowflake v0.87.2

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

Terraform Configuration

resource "snowflake_object_parameter" "AYOU_UNREDACTED_QUERIES" {
  key   = "ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR"
  value = true

  object_type = "User"
  object_identifier {
    name = "[email protected]"
  }
}

Expected Behavior

Applies the query ALTER User "[email protected]" SET ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR = true

Actual Behavior

Improperly parses the email address used for the user causing the command to fail. ALTER User "USERNAME@EMAIL"."COM" SET ENABLE_UNREDACTED_QUERY_SYNTAX_ERROR = true

Steps to Reproduce

  1. Create a user with an email address as the identifier
  2. assign above paramaeter to just that user using it's emial address
  3. Terraform apply will read it correctly, but when you confrm the change the sql command sent to snowflake breaks up the email address as if the period was identifying database sub object

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

No response

gdelia-pm avatar Apr 02 '24 18:04 gdelia-pm

Hey @gdelia-pm This seems like incorrect identifier parsing that we're planning to resolve in identifier rework. For now, I don't think there's a good workaround other than unsafe_execute.

sfc-gh-jcieslak avatar Apr 03 '24 06:04 sfc-gh-jcieslak

Thanks Jan, no rush from my end I have a workaround I just put in place for it.

gdelia-pm avatar Apr 03 '24 12:04 gdelia-pm

@sfc-gh-asawicki Hi Artur, I don't see this as having fixed the issue. Running the below version and still see the same improperly parsed email address being being passed into the query in the above example.

Terraform v1.7.3
on windows_amd64
+ provider registry.terraform.io/snowflake-labs/snowflake v0.88.0

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

gdelia-pm avatar Apr 11 '24 13:04 gdelia-pm

Hey @gdelia-pm. It was not released yet.

I agree that this PR probably did not solve this issue, but because it was linked somewhere inside the PR, it was closed automatically by GH. Reopening now.

sfc-gh-asawicki avatar Apr 11 '24 13:04 sfc-gh-asawicki

Hey @gdelia-pm 👋 FYI, during the preparation of resources for v1 we decided to put parameters related to a given object into resource schema (more details here). You will be forced manage those resources through Terraform, but on the other hand you won't have to specify every parameter through object parameter resource. The user refactor is not ready yet, but it should be in the next release (that will come somewhere around next week) or the one after. The issue is strictly connected to the identifiers, but after our identifiers rework we have a set of new tools to parse identifiers and conventions we apply in every refactored resource, so the issue should not appear there. Changes in snowflake_object_parameter are lower priority right now. Please, let us know if the new user resource with all related parameters will be sufficient solution to this problem, Thank You :)

sfc-gh-jcieslak avatar Aug 16 '24 09:08 sfc-gh-jcieslak

It doesn't work cleanly for how we setup users, since we do that completely outside of terraform, and this is a setting we'd only want a small number of users to have.
With that said as you describe it I'll definitely be able to make the change work (with minor complexity) if it's defined at the user resource, no need to do anything on the snowflake_object_parameter, the design you're describing probably makes the most sense broadly. Thanks for circling back here, I'll close this out given we're only a week or 2 from that being available

gdelia-pm avatar Aug 16 '24 18:08 gdelia-pm