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

Stream with show_initial_rows set to true is recreated every time terraform is run

Open elikschultz opened this issue 4 years ago • 2 comments

Provider Version

0.25.28

Terraform Version

v1.0.5

Describe the bug

Streams with show_initial_rows = true are recreated whenever a terraform apply is run, and are stored as having show_initial_rows = false in .tfstate file.

Expected behavior

Streams with show_initial_rows = true should only be recreated when configurations are modified, and should be stored as having show_initial_rows = true in .tfstate file.

Code samples and commands Stream created using terraform apply and resource block similar to the following:

resource "snowflake_stream" "dummy_stream" {
  database          = dummy_database
  schema            = dummy_schema
  name              =  dummy_stream
  on_table          = dummy_table
  show_initial_rows = true
  append_only       = true
}

Additional context

This is similar to the bug reported here. However, any potential solution will be complicated by the fact that the Snowflake SHOW STREAMS command does not include any information about the show_initial_rows parameter according to the documentation.

elikschultz avatar Dec 03 '21 22:12 elikschultz

@elikschultz also tripped on this. Agree on there is not a clean fix for this - even the GET_DDL function forgets about the show_initial_rows setting. image

I'm inclined to think that the less bad option would be to ignore changes in the show_initial_rows if the value is set to true. The current behavior is nasty because it leads to duplicate data on every terraform deploy

malduarte avatar Jul 26 '22 22:07 malduarte

Ha, reproducing this on our side. Nasty. Since none of the SHOW STREAMS/DESCRIBE STREAM <stream>/GET_DDL('STREAM', <stream>) commands show show_initial_rows setting, perhaps the suggestion from @malduarte is the one that makes most sense right now?

Where would it be best to point to Snowflake that this setting is missing from the output?

dlawrences avatar Jul 28 '22 09:07 dlawrences

We are closing this issue as part of a cleanup described in announcement. If you believe that the issue is still valid in v0.89.0, please open a new ticket.

sfc-gh-asawicki avatar Apr 30 '24 16:04 sfc-gh-asawicki