Skip to content

Commit

Permalink
fix - multiple typos (#1644)
Browse files Browse the repository at this point in the history
Co-authored-by: Miguel Lorek <mlorek@tenable.com>
  • Loading branch information
mlorek and Miguel Lorek authored Mar 23, 2023
1 parent 53da853 commit 5f72fee
Show file tree
Hide file tree
Showing 51 changed files with 72 additions and 72 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The following environment variables need to be set for acceptance tests to run:
* `SNOWFLAKE_PASSWORD` - Password for that user.
* `SNOWFLAKE_ROLE` - Needs to be ACCOUNTADMIN or similar.
* `SNOWFLAKE_REGION` - Default is us-west-2, set this if your snowflake account is in a different region.
* `TEST_ACC` - to enable acc tests.
* `TF_ACC` - to enable acc tests.

e.g.

Expand All @@ -104,7 +104,7 @@ export SNOWFLAKE_USER=TEST_USER
export SNOWFLAKE_PASSWORD=hunter2
export SNOWFLAKE_ROLE=ACCOUNTADMIN
export SNOWFLAKE_REGION=us-west-2
export TEST_ACC=true
export TF_ACC=true
```

**Note: PRs for new resources will not be accepted without passing acceptance tests.**
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/external_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadExternalFunctions(d *schema.ResourceData, meta interface{}) error {

currentExternalFunctions, err := snowflake.ListExternalFunctions(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] external functions in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/external_tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ReadExternalTables(d *schema.ResourceData, meta interface{}) error {

currentExternalTables, err := snowflake.ListExternalTables(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] external tables in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/file_formats.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadFileFormats(d *schema.ResourceData, meta interface{}) error {

currentFileFormats, err := snowflake.ListFileFormats(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] file formats in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/masking_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadMaskingPolicies(d *schema.ResourceData, meta interface{}) error {

currentMaskingPolicies, err := snowflake.ListMaskingPolicies(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] masking policies in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/materialized_views.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ReadMaterializedViews(d *schema.ResourceData, meta interface{}) error {

currentViews, err := snowflake.ListMaterializedViews(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] materialized views in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/pipes.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadPipes(d *schema.ResourceData, meta interface{}) error {

currentPipes, err := snowflake.ListPipes(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] pipes in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/procedures.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func ReadProcedures(d *schema.ResourceData, meta interface{}) error {

currentProcedures, err := snowflake.ListProcedures(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] procedures in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/resource_monitors.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func ReadResourceMonitors(d *schema.ResourceData, meta interface{}) error {

currentResourceMonitors, err := snowflake.ListResourceMonitors(db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] no resource monitors found in account (%s)", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/row_access_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ReadRowAccessPolicies(d *schema.ResourceData, meta interface{}) error {

currentRowAccessPolicies, err := snowflake.ListRowAccessPolicies(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] row access policy in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func ReadSchemas(d *schema.ResourceData, meta interface{}) error {

currentSchemas, err := snowflake.ListSchemas(databaseName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] schemas in database (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/sequences.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ReadSequences(d *schema.ResourceData, meta interface{}) error {

currentSequences, err := snowflake.ListSequences(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] sequences in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/stages.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadStages(d *schema.ResourceData, meta interface{}) error {

currentStages, err := snowflake.ListStages(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] stages in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/storage_integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func ReadStorageIntegrations(d *schema.ResourceData, meta interface{}) error {

currentStorageIntegrations, err := snowflake.ListStorageIntegrations(db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] no storage integrations found in account (%s)", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadStreams(d *schema.ResourceData, meta interface{}) error {

currentStreams, err := snowflake.ListStreams(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] streams in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/system_generate_scim_access_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func ReadSystemGenerateSCIMAccessToken(d *schema.ResourceData, meta interface{})
row := snowflake.QueryRow(db, sel)
accessToken, err := snowflake.ScanSCIMAccessToken(row)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] system_generate_scim_access_token (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/system_get_aws_sns_iam_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func ReadSystemGetAWSSNSIAMPolicy(d *schema.ResourceData, meta interface{}) erro
row := snowflake.QueryRow(db, sel)
policy, err := snowflake.ScanAWSSNSIAMPolicy(row)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] system_get_aws_sns_iam_policy (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/system_get_privatelink_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func ReadSystemGetPrivateLinkConfig(d *schema.ResourceData, meta interface{}) er
rawConfig, err := snowflake.ScanPrivateLinkConfig(row)

if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Println("[DEBUG] system_get_privatelink_config not found")
d.SetId("")
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/datasources/system_get_snowflake_platform_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func ReadSystemGetSnowflakePlatformInfo(d *schema.ResourceData, meta interface{}

acc, err := snowflake.ReadCurrentAccount(db)
if err != nil {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
d.SetId("")
log.Println("[DEBUG] current_account failed to decode")
return fmt.Errorf("error current_account err = %w", err)
Expand All @@ -50,7 +50,7 @@ func ReadSystemGetSnowflakePlatformInfo(d *schema.ResourceData, meta interface{}

rawInfo, err := snowflake.ScanSnowflakePlatformInfo(row)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Println("[DEBUG] system_get_snowflake_platform_info not found")
return fmt.Errorf("error system_get_snowflake_platform_info err = %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ReadTables(d *schema.ResourceData, meta interface{}) error {

currentTables, err := snowflake.ListTables(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] tables in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func ReadTasks(d *schema.ResourceData, meta interface{}) error {

currentTasks, err := snowflake.ListTasks(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] tasks in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func ReadUsers(d *schema.ResourceData, meta interface{}) error {

currentUsers, err := snowflake.ListUsers(userPattern, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] no users found in account (%s)", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ReadViews(d *schema.ResourceData, meta interface{}) error {

currentViews, err := snowflake.ListViews(databaseName, schemaName, db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] views in schema (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/datasources/warehouses.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func ReadWarehouses(d *schema.ResourceData, meta interface{}) error {

currentWarehouses, err := snowflake.ListWarehouses(db)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] no warehouses found in account (%s)", d.Id())
d.SetId("")
return nil
Expand Down
16 changes: 8 additions & 8 deletions pkg/resources/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var accountSchema = map[string]*schema.Schema{
Required: true,
Description: "Specifies the identifier (i.e. name) for the account; must be unique within an organization, regardless of which Snowflake Region the account is in. In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters except for underscores (_). Note that if the account name includes underscores, features that do not accept account names with underscores (e.g. Okta SSO or SCIM) can reference a version of the account name that substitutes hyphens (-) for the underscores.",
ValidateFunc: snowflakeValidation.ValidateAccountIdentifier,
// Name is automatically uppercased by Snowflake
// Name is automatically uppercase by Snowflake
StateFunc: func(val interface{}) string {
return strings.ToUpper(val.(string))
},
Expand All @@ -30,7 +30,7 @@ var accountSchema = map[string]*schema.Schema{
Required: true,
Description: "Login name of the initial administrative user of the account. A new user is created in the new account with this name and password and granted the ACCOUNTADMIN role in the account. A login name can be any string consisting of letters, numbers, and underscores. Login names are always case-insensitive.",
ValidateFunc: snowflakeValidation.ValidateAdminName,
// We have no way of assuming a role into this account to change the admin user name so this has to be ForceNew even though its not ideal
// We have no way of assuming a role into this account to change the admin user name so this has to be ForceNew even though it's not ideal
ForceNew: true,
DiffSuppressOnRefresh: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
Expand All @@ -48,7 +48,7 @@ var accountSchema = map[string]*schema.Schema{
Sensitive: true,
Description: "Password for the initial administrative user of the account. Optional if the `ADMIN_RSA_PUBLIC_KEY` parameter is specified. For more information about passwords in Snowflake, see [Snowflake-provided Password Policy](https://docs.snowflake.com/en/sql-reference/sql/create-account.html#:~:text=Snowflake%2Dprovided%20Password%20Policy).",
AtLeastOneOf: []string{"admin_password", "admin_rsa_public_key"},
// We have no way of assuming a role into this account to change the password so this has to be ForceNew even though its not ideal
// We have no way of assuming a role into this account to change the password so this has to be ForceNew even though it's not ideal
ForceNew: true,
DiffSuppressOnRefresh: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
Expand All @@ -66,7 +66,7 @@ var accountSchema = map[string]*schema.Schema{
Sensitive: true,
Description: "Assigns a public key to the initial administrative user of the account in order to implement [key pair authentication](https://docs.snowflake.com/en/sql-reference/sql/create-account.html#:~:text=key%20pair%20authentication) for the user. Optional if the `ADMIN_PASSWORD` parameter is specified.",
AtLeastOneOf: []string{"admin_password", "admin_rsa_public_key"},
// We have no way of assuming a role into this account to change the admin rsa public key so this has to be ForceNew even though its not ideal
// We have no way of assuming a role into this account to change the admin rsa public key so this has to be ForceNew even though it's not ideal
ForceNew: true,
DiffSuppressOnRefresh: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
Expand All @@ -83,7 +83,7 @@ var accountSchema = map[string]*schema.Schema{
Required: true,
Description: "Email address of the initial administrative user of the account. This email address is used to send any notifications about the account.",
ValidateFunc: snowflakeValidation.ValidateEmail,
// We have no way of assuming a role into this account to change the admin email so this has to be ForceNew even though its not ideal
// We have no way of assuming a role into this account to change the admin email so this has to be ForceNew even though it's not ideal
ForceNew: true,
DiffSuppressOnRefresh: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
Expand All @@ -106,7 +106,7 @@ var accountSchema = map[string]*schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "First name of the initial administrative user of the account",
// We have no way of assuming a role into this account to change the admin first name so this has to be ForceNew even though its not ideal
// We have no way of assuming a role into this account to change the admin first name so this has to be ForceNew even though it's not ideal
ForceNew: true,
DiffSuppressOnRefresh: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
Expand All @@ -122,7 +122,7 @@ var accountSchema = map[string]*schema.Schema{
Type: schema.TypeString,
Optional: true,
Description: "Last name of the initial administrative user of the account",
// We have no way of assuming a role into this account to change the admin last name so this has to be ForceNew even though its not ideal
// We have no way of assuming a role into this account to change the admin last name so this has to be ForceNew even though it's not ideal
ForceNew: true,
DiffSuppressOnRefresh: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
Expand All @@ -139,7 +139,7 @@ var accountSchema = map[string]*schema.Schema{
Optional: true,
Default: false,
Description: "Specifies whether the new user created to administer the account is forced to change their password upon first login into the account.",
// We have no way of assuming a role into this account to change the admin password policy so this has to be ForceNew even though its not ideal
// We have no way of assuming a role into this account to change the admin password policy so this has to be ForceNew even though it's not ideal
ForceNew: true,
DiffSuppressOnRefresh: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func ReadDatabase(d *schema.ResourceData, meta interface{}) error {
database, err := snowflake.ScanDatabase(row)
if err != nil {
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] database (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/file_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func ReadFileFormat(d *schema.ResourceData, meta interface{}) error {

f, err := snowflake.ScanFileFormatShow(row)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] file_format (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
4 changes: 2 additions & 2 deletions pkg/resources/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ func ReadFunction(d *schema.ResourceData, meta interface{}) error {
}
rows, err := snowflake.Query(db, stmt)
if err != nil && snowflake.IsResourceNotExistOrNotAuthorized(err.Error(), "Function") {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] function (%s) not found or we are not authorized.Err:\n%s", d.Id(), err.Error())
d.SetId("")
return nil
Expand Down Expand Up @@ -381,7 +381,7 @@ func ReadFunction(d *schema.ResourceData, meta interface{}) error {
q := funct.Show()
showRows, err := snowflake.Query(db, q)
if errors.Is(err, sql.ErrNoRows) {
// If not found, mark resource to be removed from statefile during apply or refresh
// If not found, mark resource to be removed from state file during apply or refresh
log.Printf("[DEBUG] function (%s) not found", d.Id())
d.SetId("")
return nil
Expand Down
Loading

0 comments on commit 5f72fee

Please sign in to comment.