aidanmelen / terraform-provider-snowsql

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

feat: Add read lifecycle #66

Closed aidanmelen closed 1 year ago

aidanmelen commented 1 year ago

Terraform Version

1.x.x

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 = local.name

  create {
    statements = "CREATE USER IF NOT EXISTS ${local.name} PASSWORD='${local.password}';"
  }

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

  update {
    statements = "ALTER USER IF EXISTS ${local.name} SET DISPLAY_NAME = my_example_usertf;"
  }

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

output "read_result_json" {
  value = snowsql_exec.dcl.read_result_json
}

Expected Behavior

After create or update lifecycle changes, the snowsql read_result_json attribute will contain a list of JSON formatted read query results.