-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Account v1 readiness resource (#3252)
Introduces refactor to already existing `snowflake_account` resource. ### Changes - Refactored existing account resource - Completely rewritten acceptance tests - Introduced a return type from Create command that is used to parse org_name + acc_name that is later used in creating new resource id. The output is always returned. Adding another SQL calls to get this information may an issue. For example, when account was successfully created, but e.g. current organization_name couldn't be fetched; this situation will end up with created account, but with no connection to the terraform config of this account. This could be fixed by manually importing the resource. We can discuss this on Monday. ### Next pr - data source - next account resource
- Loading branch information
1 parent
9b70f87
commit 8f5698d
Showing
25 changed files
with
1,769 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
terraform import snowflake_account.example '"<organization_name>"."<account_name>"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,42 @@ | ||
provider "snowflake" { | ||
role = "ORGADMIN" | ||
alias = "orgadmin" | ||
## Minimal | ||
resource "snowflake_account" "minimal" { | ||
name = "ACCOUNT_NAME" | ||
admin_name = "ADMIN_NAME" | ||
admin_password = "ADMIN_PASSWORD" | ||
email = "admin@email.com" | ||
edition = "STANDARD" | ||
grace_period_in_days = 3 | ||
} | ||
|
||
## Complete (with SERVICE user type) | ||
resource "snowflake_account" "complete" { | ||
name = "ACCOUNT_NAME" | ||
admin_name = "ADMIN_NAME" | ||
admin_rsa_public_key = "<public_key>" | ||
admin_user_type = "SERVICE" | ||
email = "admin@email.com" | ||
edition = "STANDARD" | ||
region_group = "PUBLIC" | ||
region = "AWS_US_WEST_2" | ||
comment = "some comment" | ||
is_org_admin = "true" | ||
grace_period_in_days = 3 | ||
} | ||
|
||
resource "snowflake_account" "ac1" { | ||
provider = snowflake.orgadmin | ||
name = "SNOWFLAKE_TEST_ACCOUNT" | ||
admin_name = "John Doe" | ||
admin_password = "Abcd1234!" | ||
email = "john.doe@snowflake.com" | ||
first_name = "John" | ||
last_name = "Doe" | ||
must_change_password = true | ||
## Complete (with PERSON user type) | ||
resource "snowflake_account" "complete" { | ||
name = "ACCOUNT_NAME" | ||
admin_name = "ADMIN_NAME" | ||
admin_password = "ADMIN_PASSWORD" | ||
admin_user_type = "PERSON" | ||
first_name = "first_name" | ||
last_name = "last_name" | ||
email = "admin@email.com" | ||
must_change_password = "false" | ||
edition = "STANDARD" | ||
comment = "Snowflake Test Account" | ||
region_group = "PUBLIC" | ||
region = "AWS_US_WEST_2" | ||
comment = "some comment" | ||
is_org_admin = "true" | ||
grace_period_in_days = 3 | ||
} |
6 changes: 3 additions & 3 deletions
6
pkg/acceptance/bettertestspoc/assert/objectassert/account_snowflake_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
pkg/acceptance/bettertestspoc/assert/resourceassert/account_resource_ext.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package resourceassert | ||
|
||
import ( | ||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert" | ||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
) | ||
|
||
func (a *AccountResourceAssert) HasAdminUserType(expected sdk.UserType) *AccountResourceAssert { | ||
a.AddAssertion(assert.ValueSet("admin_user_type", string(expected))) | ||
return a | ||
} |
10 changes: 10 additions & 0 deletions
10
pkg/acceptance/bettertestspoc/assert/resourceassert/account_resource_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.