Skip to content

[Bug]: snowflake_table_constraint wrong default value #3382

Open
@martinw-intersport

Description

Terraform CLI Version

1.10.5

Terraform Provider Version

1.0.2

Company Name

No response

Terraform Configuration

# Add foreign key constraints
resource "snowflake_table_constraint" "constraint" {
  name     = "FKEY"
  type     = "FOREIGN KEY"
  enforced = false
  table_id = snowflake_table.b.fully_qualified_name
  columns  = ["ID"]
  foreign_key_properties {
    references {
      table_id = snowflake_table.a.fully_qualified_name
      columns  = ["ID"]
    }
  }
}

Category

category:resource

Object type(s)

No response

Expected Behavior

According to https://docs.snowflake.com/en/sql-reference/sql/create-table-constraint#constraint-properties, the default value are NOT DEFERRABLE and DISABLE, so deferrable = false and enable= false

Actual Behavior

current terraform plan

+ resource "snowflake_table_constraint" "constraint" {
       + columns    = [
           + "ID",
         ]
       + deferrable = true  <-----wrong
       + enable     = true  <-----wrong
       + enforced   = false
       + id         = (known after apply)
       + initially  = "DEFERRED"
       + name       = "FKEY"
       + rely       = true
       + table_id   = (known after apply)
       + type       = "FOREIGN KEY"
       + validate   = false
       + foreign_key_properties {
           + match     = "FULL"
           + on_delete = "NO ACTION"
           + on_update = "NO ACTION"
           + references {
               + columns  = [
                   + "ID",
                 ]
               + table_id = "..."
             }
         }
     }

Steps to Reproduce

  1. Copy Terraform Configuration
  2. Run terraform plan
  3. Check enable and deferrable value

How much impact is this issue causing?

Low

Logs

No response

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎

Metadata

Assignees

No one assigned

    Labels

    feature-requestUsed to mark issues with provider's missing functionalitiesgeneral-usageGeneral help/usage questionsresource:tableIssue connected to the snowflake_table resourceresource:table_constraintIssue connected to the snowflake_table_constraint resource

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions