Skip to content

Commit

Permalink
Changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed May 28, 2024
1 parent c52566d commit 67c3889
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 42 deletions.
14 changes: 8 additions & 6 deletions docs/resources/secondary_database.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ resource "snowflake_secondary_database" "test" {
value = 20
}
external_volume = "external_volume_name"
catalog = "catalog_name"
default_ddl_collation = "en_US"
log_level = "OFF"
trace_level = "OFF"
comment = "A secondary database"
external_volume = "external_volume_name"
catalog = "catalog_name"
replace_invalid_characters = false
default_ddl_collation = "en_US"
storage_serialization_policy = "OPTIMIZED"
log_level = "OFF"
trace_level = "OFF"
comment = "A secondary database"
}
```

Expand Down
24 changes: 13 additions & 11 deletions docs/resources/shared_database.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@ resource "snowflake_grant_privileges_to_share" "test" {
# 2. Creating shared database
resource "snowflake_shared_database" "test" {
provider = secondary_account
depends_on = [snowflake_grant_privileges_to_share.test]
name = snowflake_database.test.name # shared database should have the same as the "imported" one
from_share = "<primary_account_organization_name>.<primary_account_name>.${snowflake_share.test.name}"
is_transient = false
external_volume = "external_volume_name"
catalog = "catalog_name"
default_ddl_collation = "en_US"
log_level = "OFF"
trace_level = "OFF"
comment = "A shared database"
provider = secondary_account
depends_on = [snowflake_grant_privileges_to_share.test]
name = snowflake_database.test.name # shared database should have the same as the "imported" one
from_share = "<primary_account_organization_name>.<primary_account_name>.${snowflake_share.test.name}"
is_transient = false
external_volume = "external_volume_name"
catalog = "catalog_name"
replace_invalid_characters = false
default_ddl_collation = "en_US"
storage_serialization_policy = "OPTIMIZED"
log_level = "OFF"
trace_level = "OFF"
comment = "A shared database"
}
```

Expand Down
14 changes: 8 additions & 6 deletions examples/resources/snowflake_secondary_database/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ resource "snowflake_secondary_database" "test" {
value = 20
}

external_volume = "external_volume_name"
catalog = "catalog_name"
default_ddl_collation = "en_US"
log_level = "OFF"
trace_level = "OFF"
comment = "A secondary database"
external_volume = "external_volume_name"
catalog = "catalog_name"
replace_invalid_characters = false
default_ddl_collation = "en_US"
storage_serialization_policy = "OPTIMIZED"
log_level = "OFF"
trace_level = "OFF"
comment = "A secondary database"
}
24 changes: 13 additions & 11 deletions examples/resources/snowflake_shared_database/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ resource "snowflake_grant_privileges_to_share" "test" {

# 2. Creating shared database
resource "snowflake_shared_database" "test" {
provider = secondary_account
depends_on = [snowflake_grant_privileges_to_share.test]
name = snowflake_database.test.name # shared database should have the same as the "imported" one
from_share = "<primary_account_organization_name>.<primary_account_name>.${snowflake_share.test.name}"
is_transient = false
external_volume = "external_volume_name"
catalog = "catalog_name"
default_ddl_collation = "en_US"
log_level = "OFF"
trace_level = "OFF"
comment = "A shared database"
provider = secondary_account
depends_on = [snowflake_grant_privileges_to_share.test]
name = snowflake_database.test.name # shared database should have the same as the "imported" one
from_share = "<primary_account_organization_name>.<primary_account_name>.${snowflake_share.test.name}"
is_transient = false
external_volume = "external_volume_name"
catalog = "catalog_name"
replace_invalid_characters = false
default_ddl_collation = "en_US"
storage_serialization_policy = "OPTIMIZED"
log_level = "OFF"
trace_level = "OFF"
comment = "A shared database"
}
14 changes: 6 additions & 8 deletions pkg/sdk/testint/databases_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,11 @@ func TestInt_DatabasesCreateSecondary(t *testing.T) {
secondaryClient := testSecondaryClient(t)
ctx := testContext(t)

// Database name will be shared between two accounts
databaseId := testClientHelper().Ids.RandomAccountObjectIdentifier()

sharedDatabase, sharedDatabaseCleanup := secondaryTestClientHelper().Database.CreateDatabaseWithName(t, databaseId.Name())
sharedDatabase, sharedDatabaseCleanup := secondaryTestClientHelper().Database.CreateDatabase(t)
t.Cleanup(sharedDatabaseCleanup)

databaseId := sharedDatabase.ID()

err := secondaryClient.Databases.AlterReplication(ctx, sharedDatabase.ID(), &sdk.AlterDatabaseReplicationOptions{
EnableReplication: &sdk.EnableReplication{
ToAccounts: []sdk.AccountIdentifier{
Expand Down Expand Up @@ -366,12 +365,11 @@ func TestInt_DatabasesAlter(t *testing.T) {
shareTest, shareCleanup := secondaryTestClientHelper().Share.CreateShare(t)
t.Cleanup(shareCleanup)

// Database name will be shared between two accounts
databaseId := testClientHelper().Ids.RandomAccountObjectIdentifier()

sharedDatabase, sharedDatabaseCleanup := secondaryTestClientHelper().Database.CreateDatabaseWithName(t, databaseId.Name())
sharedDatabase, sharedDatabaseCleanup := secondaryTestClientHelper().Database.CreateDatabase(t)
t.Cleanup(sharedDatabaseCleanup)

databaseId := sharedDatabase.ID()

err := secondaryClient.Grants.GrantPrivilegeToShare(ctx, []sdk.ObjectPrivilege{sdk.ObjectPrivilegeUsage}, &sdk.ShareGrantOn{
Database: sharedDatabase.ID(),
}, shareTest.ID())
Expand Down

0 comments on commit 67c3889

Please sign in to comment.