Snowflake-Labs / terraform-provider-snowflake

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

[Bug]: snowflake_notification_integration resource parameters type and direction are incorrectly considered as deprecated #3138

Open ajain-coveo opened 1 month ago

ajain-coveo commented 1 month ago

Terraform CLI Version

1.7.4

Terraform Provider Version

0.85.0

Terraform Configuration

For resource - snowflake_notification_integration, the parameters "type" and "direction" are incorrectly considered as deprecated as per the documentation on snowflake terraform provider.
Hence a warning shows up when creating this resource with these params as following:

Warning: Argument is deprecated
│ 
│   with snowflake_notification_integration.snowflake_sns_integration,
│   on notification_integration.tf line 5, in resource "snowflake_notification_integration" "snowflake_sns_integration":
│    5:   direction             = "OUTBOUND"
│ 
│ Will be removed - it is added automatically on the SDK level.

However as per the Snowflake documentation these parameters, "type" and "direction", are still required parameters.  Hence this warning is incorrect and confusing. In my view the warning should be removed.

Category

category:resource

Object type(s)

No response

Expected Behavior

No Warning related to "type" and "direction" parameters in snowflake_notification_integration (Resource)

Actual Behavior

"type" and "direction" parameters show as deprecated in snowflake_notification_integration (Resource)

Steps to Reproduce

  1. Copy the following configuration:

    resource "snowflake_notification_integration" "snowflake_sns_integration" {
    name                  = "snowflake_notification_integration_name"
    enabled               = true
    type                  = "QUEUE"
    direction             = "OUTBOUND"
    notification_provider = "AWS_SNS"
    aws_sns_topic_arn     = aws_sns_topic.snowflake_sns_topic.arn
    aws_sns_role_arn      = "aws_sns_role_arn"
    }
  2. Run terraform apply

How much impact is this issue causing?

Low

Logs

No response

Additional Information

No response

Would you like to implement a fix?

sfc-gh-jmichalak commented 1 month ago

Hi @ajain-coveo 👋

These fields were deprecated because they are filled by the provider itself. Please remove them from the config for now.

Note that we will rework this resource - it's on our Remaining Objects list. We'll probably split this resource into multiple resources based on type and/or direction.

sfc-gh-asawicki commented 1 month ago

Hey @ajain-coveo. Thanks for reaching out to us.

These parameters are not needed on the resource level. However, they are added automatically (that's what the deprecation message says: Will be removed - it is added automatically on the SDK level.).

The reason is that you can't modify these attributes for the given notification. For example, check the doc for SNS: https://docs.snowflake.com/en/sql-reference/sql/create-notification-integration-queue-outbound-aws (TYPE and DIRECTION are fixed). That's why the provider ignores the provided values for these parameters.

We plan to rework this resource and split it into more granular type-specific resources (like the one for the email we already have), but these attributes will also not be needed then.