Search code examples
terraformsnowflake-cloud-data-platform

Terraform Snowflake: create a database without public schema


When I create a Snowflake table with the database resource it will automatically create a schema PUBLIC. How can I prevent this behaviour?

resource "snowflake_database" "simple" {
  name                        = "testing"
  comment                     = "test comment"
  data_retention_time_in_days = 3
}

Solution

  • A database will be created with the PUBLIC schema by default.

    By default, all users have access to this schema. You can restrict access using REVOKE. https://docs.snowflake.com/en/sql-reference/sql/revoke-privilege