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

snowflake_table "data_rentention_days" and "data_retention_time_in_days" chaos

Open JESCHO99 opened this issue 1 year ago • 2 comments

Terraform CLI and Provider Versions

0.85.0

Terraform Configuration

"data_retention_days": {
		Type:         schema.TypeInt,
		Optional:     true,
		Default:      1,
		Description:  "Specifies the retention period for the table so that Time Travel actions (SELECT, CLONE, UNDROP) can be performed on historical data in the table. Default value is 1, if you wish to inherit the parent schema setting then pass in the schema attribute to this argument.",
		ValidateFunc: validation.IntBetween(0, 90),
		Deprecated:   "Use snowflake_object_parameter instead",
		Type:          schema.TypeInt,
		Optional:      true,
		Description:   "Specifies the retention period for the table so that Time Travel actions (SELECT, CLONE, UNDROP) can be performed on historical data in the table. Default value is 1, if you wish to inherit the parent schema setting then pass in the schema attribute to this argument.",
		ValidateFunc:  validation.IntBetween(0, 90),
		Deprecated:    "Use data_retention_time_in_days attribute instead",
		ConflictsWith: []string{"data_retention_time_in_days"},
	},
	"data_retention_time_in_days": {
		Type:          schema.TypeInt,
		Optional:      true,
		Description:   "Specifies the retention period for the table so that Time Travel actions (SELECT, CLONE, UNDROP) can be performed on historical data in the table. Default value is 1, if you wish to inherit the parent schema setting then pass in the schema attribute to this argument.",
		ValidateFunc:  validation.IntBetween(0, 90),
		Deprecated:    "Use snowflake_object_parameter instead",
		ConflictsWith: []string{"data_retention_days"},
	},

Expected Behavior

Both arguments for a snowflake table "data_rentention_days" and "data_retention_time_in_days" are market as deprecated and pop up as a warning every time you execute a plan. For me it looks like "data_retention_time_in_days" should be the right parameter but the depreciation warning was just merged from the previous resource and was not changed.

Actual Behavior

You get unwanted error messages and it is unclear which of the parameters to use or in general which parameter should be used to configure the rentention time of a table.

Steps to Reproduce

  1. terraform plan

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

No response

JESCHO99 avatar Feb 12 '24 16:02 JESCHO99

Hey @JESCHO99. Thanks for creating the issue.

The correct one is data_retention_time_in_days . This is the result of https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/1938#issuecomment-1650685469. The new argument was introduced, but the deprecation message was not removed. I will remove it this week.

Please be aware that there is also the issue https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2356 that relatively affects the data retention set on db, schema, or table level. We are currently working on it; it should land in v0.86.0 or 0.87.0 at the latest.

sfc-gh-asawicki avatar Feb 12 '24 16:02 sfc-gh-asawicki

@JESCHO99 We removed the deprecation and released it as part of 0.86.0.

sfc-gh-asawicki avatar Feb 16 '24 07:02 sfc-gh-asawicki

Closing the issue. Please create a new one if the issue persists in the newest provider version.

sfc-gh-asawicki avatar Mar 13 '24 13:03 sfc-gh-asawicki