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

[Bug]: During import of snowflake_warehouse, terraform plan output indicates, that property query_acceleration_max_scale_factor will be setted (updated) #2763

Closed
1 task
Hunter-99 opened this issue Apr 30, 2024 · 4 comments
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@Hunter-99
Copy link

Hunter-99 commented Apr 30, 2024

Terraform CLI Version

1.8.2

Terraform Provider Version

0.89

Terraform Configuration

resource "snowflake_warehouse" "warehouse" {

  name                                = "TEST_WAREHOUSE"
  warehouse_size                      = "SMALL"
  comment                             = ""
  auto_resume                         = true
  min_cluster_count                   = 1
  max_cluster_count                   = 1
  max_concurrency_level               = 8
  query_acceleration_max_scale_factor = 8
  statement_queued_timeout_in_seconds = 0
  statement_timeout_in_seconds        = 172800
  scaling_policy                      = "STANDARD"
  enable_query_acceleration           = false
}

Category

category:resource

Object type(s)

resource:warehouse

Expected Behavior

...
  # snowflake_warehouse.warehouse["TEST_WAREHOUSE"] will be imported
    resource "snowflake_warehouse" "warehouse" {
        auto_resume = true
        comment = ""
        enable_query_acceleration = false
        id = "TEST_WAREHOUSE"
        max_cluster_count = 1
        max_concurrency_level = 8
        min_cluster_count = 1
        name = "TEST_WAREHOUSE"
        query_acceleration_max_scale_factor = 8
        resource_monitor = "null"
        scaling_policy = "STANDARD"
        statement_queued_timeout_in_seconds = 0
        statement_timeout_in_seconds = 172800
        warehouse_size = "SMALL"
        warehouse_type = "STANDARD"
    }
...

Actual Behavior

... 

 # snowflake_warehouse.warehouse["TEST_WAREHOUSE"] will be updated in-place
  # (imported from "TEST_WAREHOUSE")
  ~ resource "snowflake_warehouse" "warehouse" {
        auto_resume = true
        comment = ""
        enable_query_acceleration = false
        id = "TEST_WAREHOUSE"
        max_cluster_count = 1
        max_concurrency_level = 8
        min_cluster_count = 1
        name = "TEST_WAREHOUSE"
      + query_acceleration_max_scale_factor = 8
        resource_monitor = "null"
        scaling_policy = "STANDARD"
        statement_queued_timeout_in_seconds = 0
        statement_timeout_in_seconds = 172800
        warehouse_size = "SMALL"
        warehouse_type = "STANDARD"
    }

...

Steps to Reproduce

  1. Create resourse snowflake_warehouse:
resource "snowflake_warehouse" "warehouse" {
        auto_resume = true
        comment = ""
        enable_query_acceleration = false
        id = "TEST_WAREHOUSE"
        max_cluster_count = 1
        max_concurrency_level = 8
        min_cluster_count = 1
        name = "TEST_WAREHOUSE"
        query_acceleration_max_scale_factor = 8
        resource_monitor = "null"
        scaling_policy = "STANDARD"
        statement_queued_timeout_in_seconds = 0
        statement_timeout_in_seconds = 172800
        warehouse_size = "SMALL"
        warehouse_type = "STANDARD"
    }
  1. Run terraform plan

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

This issue (bug) happend, only when enable_query_acceleration param for warehouse is false (but query_acceleration_max_scale_factor equals, for example 8).

See the following part of ReadWarehouse func:

if w.EnableQueryAcceleration {
if err = d.Set("query_acceleration_max_scale_factor", w.QueryAccelerationMaxScaleFactor); err != nil {
return err
}
}
return nil

In this code, when terraform checks warehouse, and see, that enable_query_acceleration = false, then terraform will think, that query_acceleration_max_scale_factor is null.

But, in UpdateWarehouse function it will be set query_acceleration_max_scale_factor (8 by default), even though enable_query_acceleration = false

if d.HasChange("query_acceleration_max_scale_factor") {
runSet = true
set.QueryAccelerationMaxScaleFactor = sdk.Int(d.Get("query_acceleration_max_scale_factor").(int))
}

Thus, I think, we need to read query_acceleration_max_scale_factor property in ReadWarehouse, regardless of the enable_query_acceleration value

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@Hunter-99 Hunter-99 added the bug Used to mark issues with provider's incorrect behavior label Apr 30, 2024
@Hunter-99 Hunter-99 changed the title [Bug]: During import of snowflake_warehouse, terraform plan output indicates, that property query_acceleration_max_scale_factor will be setted [Bug]: During import of snowflake_warehouse, terraform plan output indicates, that property query_acceleration_max_scale_factor will be setted (updated) Apr 30, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @Hunter-99. Thanks for reaching out to us.

I will try to reproduce this today. I will also find out why the attached logic was written this way.

sfc-gh-asawicki added a commit that referenced this issue May 6, 2024
This is only to align import with the current warehouse behavior. It will change with SNOW-1348102.

References: #2763
sfc-gh-asawicki added a commit that referenced this issue May 7, 2024
- Add missing parameters (References #2676)
- Temporary fix the warehouse resource behavior; it will be addressed
with the warehouse redesign because the existing conditional logic is
questionable and we plan to get rid of the defaults (SNOW-1348102)
(References #2763)
- Prove data type problem with functions; it will be addressed with
function redesign because it requires deeper refactor (SNOW-1348103)
(References #2735)
- Suppress the diff for synonym columns in table resource; it will be
addressed with table redesign because the collate test had to be skipped
(SNOW-1348114) (References #2733)
sfc-gh-jcieslak pushed a commit that referenced this issue May 8, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.90.0](v0.89.0...v0.90.0)
(2024-05-08)


### 🎉 **What's new:**

* Adjust owner_role_type and schema_evolution_record columns
([#2740](#2740))
([424e393](424e393))


### 🔧 **Misc**

* Add a guide on creating issues
([#2758](#2758))
([2b006aa](2b006aa))
* Add missing documentation
([#2781](#2781))
([cc0a6a7](cc0a6a7))
* Add scripts to close issues from Pre Snowflake bucket
([#2762](#2762))
([44c0c37](44c0c37))
* Add small adjustments
([#2783](#2783))
([e5b0b4b](e5b0b4b))
* Adjust issue templates
([#2748](#2748))
([64ab76d](64ab76d))
* Cleanup helpers part 3
([#2730](#2730))
([eb7bee4](eb7bee4))
* Cleanup helpers part 5
([#2744](#2744))
([1f165bf](1f165bf))
* Cleanup helpers part4
([#2741](#2741))
([9475e35](9475e35))
* Cleanup helpers part6
([#2745](#2745))
([eba3029](eba3029))
* Cleanup helpers poc
([#2724](#2724))
([70b99fb](70b99fb))
* Helpers cleanup continuation
([#2726](#2726))
([a70d1af](a70d1af))
* Prepare new roadmap entry
([#2773](#2773))
([b0bf28f](b0bf28f))
* Prepare parallel builds
([#2737](#2737))
([6974e25](6974e25))
* Update the contribution guidelines (and small fixes)
([#2753](#2753))
([aafdc72](aafdc72))


### 🐛 **Bug fixes:**

* Fix issue templates
([#2760](#2760))
([d0d5048](d0d5048))
* Fix setup for two tests
([#2757](#2757))
([df025b0](df025b0))
* Fix Test (wrong order of arguments)
([#2780](#2780))
([02f467e](02f467e))
* Fix/prove issues
[#2733](#2733)
[#2735](#2735)
[#2763](#2763)
[#2767](#2767)
([#2777](#2777))
([7b1c67e](7b1c67e))
* Prove problems with procedure resource data types
([#2782](#2782))
([68d0318](68d0318))
* read after create
([#2718](#2718))
([2e9b68f](2e9b68f))
* UNSET and empty SET in network policies
([#2759](#2759))
([3eacb0b](3eacb0b))
* unset network policy should not have single quotes
([#2584](#2584))
([8f2a363](8f2a363))
* Update failover group allowed integration types
([#2776](#2776))
([efde48d](efde48d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: snowflake-release-please[bot] <105954990+snowflake-release-please[bot]@users.noreply.github.com>
@sfc-gh-jcieslak
Copy link
Collaborator

sfc-gh-jcieslak commented May 8, 2024

Hey @Hunter-99 👋
Today, we released a new version v0.90.0 that contained a fix for your issue. Please, let us know if you're still experiencing this issue in the latest version (also mind there were small breaking changes documented here).

@Hunter-99
Copy link
Author

@sfc-gh-jcieslak, @sfc-gh-asawicki thanks! Now it works as I expected.

@sfc-gh-asawicki
Copy link
Collaborator

Hey @Hunter-99. Just letting you know that warehouse resource was redesigned and the behavior for enable_query_acceleration will change starting from v0.93.0. You can check the migration guide. The release should happen this week.

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
Projects
None yet
Development

No branches or pull requests

3 participants