Snowflake-Labs / terraform-provider-snowflake

Terraform provider for managing Snowflake accounts
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest
MIT License
535 stars 414 forks source link

Terraform shows diff in start_timestamp of Snowflake's resource monitor just after apply #1821

Open LucasMMota opened 1 year ago

LucasMMota commented 1 year ago

Provider Version

provider registry.terraform.io/snowflake-labs/snowflake v0.63.0

Terraform Version

Terraform v1.4.5

Describe the bug

The start date of resource monitor cannot be set as saved in the database (e.g.: "2023-04-24T03:00:00Z"). Although if we use the expected format by the provider, the plan presents a difference just after the apply.

Expected behavior

No diff after the apply. Or provider accepts the format stored in DB with the timezone (e.g.: "2023-04-24T03:00:00Z")

Code samples and commands

The resource monitor object:

 {
    name            = "RM_WH_REPORTING"
    credit_quota    = 30
    frequency       = "DAILY"
    start_timestamp = "2023-05-23"
    notify_triggers = [80, 90]
    suspend_immediate_trigger = 100
    notify_users    = ["SNOWFLAKE_ALERTS_SLACK_INTEGRATION"]
    grant_privileges_by_role = {
      TRANSFORMER : ["MONITOR"]
    }
  }

The plan:

 # module.resource_monitor["RM_WH_REPORTING"].snowflake_resource_monitor.monitor will be created
  + resource "snowflake_resource_monitor" "monitor" {
      + credit_quota              = 30
      + frequency                 = "DAILY"
      + id                        = (known after apply)
      + name                      = "RM_WH_REPORTING"
      + notify_triggers           = [
          + 80,
          + 90,
        ]
      + notify_users              = [
          + "SNOWFLAKE_ALERTS_SLACK_INTEGRATION",
        ]
      + set_for_account           = false
      + start_timestamp           = "2023-05-23"
      + suspend_immediate_trigger = 100
    }

The terraform plan after applying:

  # module.resource_monitor["RM_WH_REPORTING"].snowflake_resource_monitor.monitor will be updated in-place
  ~ resource "snowflake_resource_monitor" "monitor" {
        id                        = "RM_WH_REPORTING"
        name                      = "RM_WH_REPORTING"
      ~ start_timestamp           = "2023-05-23T00:00:00Z" -> "2023-05-23"
sfc-gh-jcieslak commented 2 weeks ago

Hello 👋 Please refer to this response - https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/1175#issuecomment-2331300488. I'll let you know whenever the updated resource is available.

sfc-gh-jcieslak commented 3 days ago

Hey 👋 The new and refactored resource monitor was released yesterday in version 0.96.0 of the provider. Please migrate with migration guide and let me know if the issue has been resolved so we could close the ticket. Thanks in advance 🙏.