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

Task cannot be updated to remove "when" #2036

Closed
shellderp opened this issue Aug 29, 2023 · 5 comments
Closed

Task cannot be updated to remove "when" #2036

shellderp opened this issue Aug 29, 2023 · 5 comments
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:task Issue connected to the snowflake_task resource

Comments

@shellderp
Copy link

shellderp commented Aug 29, 2023

Provider Version

0.70.0

Terraform Version

v1.2.4

Describe the bug

│ Error: error updating when condition on task

Expected behavior

The task should be recreated with no when condition. In Terraform this could be implemented as "forces replacement"

Code samples and commands

For example, apply the following

resource "snowflake_task" "task" {
  name          = "sample"
  sql_statement = "..."
  when    = "system$stream_has_data('sample_stream')"
  enabled = true
}

Then change it to this and apply again

resource "snowflake_task" "task" {
  name          = "sample"
  sql_statement = "..."
  enabled = true
}

Additional context

Adding a when condition to a task without the when does already work.

@shellderp shellderp added the bug Used to mark issues with provider's incorrect behavior label Aug 29, 2023
@sfc-gh-asawicki
Copy link
Collaborator

Hey @shellderp. Thanks for creating the ticket.

The problem comes from a gap in the ALTER TASK statement (currently, there is no way to UNSET it - other than dropping and recreating). Setting when to TRUE should work as a workaround when clearing when like in the example.

@sfc-gh-asawicki
Copy link
Collaborator

@shellderp can you confirm it works?

@shellderp
Copy link
Author

it works to drop and recreate, yes

sfc-gh-asawicki added a commit that referenced this issue Feb 8, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Changed the behavior in #2479 (conditional forceNew).

sfc-gh-asawicki added a commit that referenced this issue Feb 8, 2024
Related issues: #2036 #2207 #2346.

- (#2207) The reason was the change in parsing the `SHOW TASKS` response
for `after` parameter. In earlier versions, the parsing was incorrect
for the identifiers containing dot characters. The new one fixed the dot
case but Snowflake identifiers surprised us one more time, and the basic
case, without any `"` was not supported correctly.
- (#2036) There is no way to unset `when` currently in Snowflake. We
don't want to always `ForceNew` for when change. For that reason we run
forceNew conditionally using `customdiff.ForceNewIfChange`.
- (#2346) Waiting for answers but maybe this fix will also solve this
issues.
@sfc-gh-asawicki
Copy link
Collaborator

Closing the issue because it was fixed. @shellderp please create a new one if you encounter the bad behavior in the newest provider version.

@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:task Issue connected to the snowflake_task resource labels May 20, 2024
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:task Issue connected to the snowflake_task resource
Projects
None yet
Development

No branches or pull requests

3 participants