Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snowflake_object_parameter parsing error #2669

Closed
gdelia-pm opened this issue Apr 2, 2024 · 6 comments · Fixed by #2675
Closed

snowflake_object_parameter parsing error #2669

gdelia-pm opened this issue Apr 2, 2024 · 6 comments · Fixed by #2675
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:object_parameter Issue connected to the snowflake_object_parameter resource

Comments

@gdelia-pm
Copy link

gdelia-pm commented Apr 2, 2024

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 gdelia-pm added the bug Used to mark issues with provider's incorrect behavior label Apr 2, 2024
@sfc-gh-jcieslak
Copy link
Collaborator

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.

@gdelia-pm
Copy link
Author

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

sfc-gh-asawicki pushed a commit that referenced this issue Apr 11, 2024
…2675)

When issuing `object_type = "USER"` via the `snowflake_object_parameter`
resource the `ShowObjectParameter` function did not handle the
`ObjectTypeUser` which led to invalid ObjectType errors.

## Test Plan
* [x] acceptance tests


## References
* ~~Fixes #2669~~ Actually, I re-reading this issue I don't think it
fixes this error.
@gdelia-pm
Copy link
Author

@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```

@sfc-gh-asawicki
Copy link
Collaborator

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-jcieslak sfc-gh-jcieslak added resource:object_parameter Issue connected to the snowflake_object_parameter resource category:resource labels May 20, 2024
@sfc-gh-jcieslak
Copy link
Collaborator

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 :)

@gdelia-pm
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:object_parameter Issue connected to the snowflake_object_parameter resource
Projects
None yet
3 participants