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

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

Closed
LucasMMota opened this issue May 22, 2023 · 3 comments
Assignees
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:resource_monitor Issue connected to the snowflake_resource_monitor resource

Comments

@LucasMMota
Copy link

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"
@LucasMMota LucasMMota added the bug Used to mark issues with provider's incorrect behavior label May 22, 2023
@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:resource_monitor Issue connected to the snowflake_resource_monitor resource labels May 20, 2024
@sfc-gh-jcieslak
Copy link
Collaborator

Hello 👋
Please refer to this response - #1175 (comment). I'll let you know whenever the updated resource is available.

@sfc-gh-jcieslak sfc-gh-jcieslak self-assigned this Sep 5, 2024
sfc-gh-jcieslak added a commit that referenced this issue Sep 11, 2024
## Changes
- Add ValuePresent assert to our custom assertions
- Add ToConfigValues function for every model
- Update Resource Monitor SDK + unit and integration tests
- Update Resource Monitor Resource + acc tests
- Handle issues connected to the resource monitor (mostly timestamp
format difference causing infinite plan or only trigger updates causing
SQL compilation error):
  -  #1500 
  - #1624 
  - #1716 
  - #1754 
  - #1821 
  - #1832 
  - #1990

## Next pr
- Adjust examples and update migration notes
- Data source (impl, tests, examples, migration notes)

## References
* [CREATE RESOURCE
MONITOR](https://docs.snowflake.com/en/sql-reference/sql/create-resource-monitor)
sfc-gh-fbudzynski pushed a commit that referenced this issue Sep 19, 2024
## Changes
- Add ValuePresent assert to our custom assertions
- Add ToConfigValues function for every model
- Update Resource Monitor SDK + unit and integration tests
- Update Resource Monitor Resource + acc tests
- Handle issues connected to the resource monitor (mostly timestamp
format difference causing infinite plan or only trigger updates causing
SQL compilation error):
  -  #1500 
  - #1624 
  - #1716 
  - #1754 
  - #1821 
  - #1832 
  - #1990

## Next pr
- Adjust examples and update migration notes
- Data source (impl, tests, examples, migration notes)

## References
* [CREATE RESOURCE
MONITOR](https://docs.snowflake.com/en/sql-reference/sql/create-resource-monitor)
@sfc-gh-jcieslak
Copy link
Collaborator

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 🙏.

@sfc-gh-jcieslak
Copy link
Collaborator

Closing due to long inactivity. Please, create another issue if you think the problem is still not resolved.

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:resource_monitor Issue connected to the snowflake_resource_monitor resource
Projects
None yet
Development

No branches or pull requests

2 participants