aidanmelen / terraform-provider-snowsql

Terraform SnowSQL provider
https://registry.terraform.io/providers/aidanmelen/snowsql/latest
Other
22 stars 10 forks source link

Error when update block is removed #65

Closed aidanmelen closed 1 year ago

aidanmelen commented 1 year ago

Terraform Version

1.1.0

Affected Resource(s)

Please list the resources as a list, for example:

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "snowsql_exec" "dcl" {
  name = var.name

  create {
    statements = "CREATE USER IF NOT EXISTS ${var.name} PASSWORD=${var.temporary_user_password} DEFAULT_ROLE = myrole DEFAULT_SECONDARY_ROLES = ('ALL') MUST_CHANGE_PASSWORD = TRUE;"
  }

  # read {
  #   statements = "SHOW USERS LIKE '${var.name}';"
  # }

  # comment after apply
  # update {
  #   statements = "ALTER USER IF EXISTS user1 SET EMAIL = '${var.name}@email.com';"
  # }

  delete {
    statements = "DROP USER IF EXISTS ${var.name};"
  }
}

Debug Output

Screen Shot 2023-02-11 at 7 36 15 AM

Expected Behavior

an in-place update where the update changes to null as the snowlake object is unchanged.

Actual Behavior

state error in provider

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply with the update block
  2. terraform apply again without the update block

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: