Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to scan row for SHOW ORGANIZATION ACCOUNTS #1606

Closed
jrobison-sb opened this issue Mar 7, 2023 · 7 comments · Fixed by #1673
Closed

unable to scan row for SHOW ORGANIZATION ACCOUNTS #1606

jrobison-sb opened this issue Mar 7, 2023 · 7 comments · Fixed by #1673
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@jrobison-sb
Copy link
Contributor

Provider Version

provider registry.terraform.io/snowflake-labs/snowflake v0.56.0

Terraform Version

Terraform v1.3.6

Describe the bug

terraform plan crashes with this error:

│ Error: error reading account: unable to scan row for SHOW ORGANIZATION ACCOUNTS LIKE 'ABC12345' err = missing destination name is_org_admin in *[]snowflake.Account
│ 
│   with module.snowflake_accounts.snowflake_account.account["SOMEACCOUNT"],
│   on ../../modules/aws/snowflake_accounts/main.tf line 28, in resource "snowflake_account" "account":
│   28: resource "snowflake_account" "account" {

Expected behavior

No error message.

Code samples and commands

  accounts = [
    "SOMEACCOUNT",
    "SOMEOTHERACCOUNT",
  ]

resource "snowflake_account" "account" {
  for_each             = toset(var.accounts)
  provider             = snowflake.orgadmin
  admin_name           = "AUTOMATION"
  admin_rsa_public_key = replace(trimprefix(trimsuffix(data.tls_public_key.public_key.public_key_pem, "-----END RSA PRIVATE KEY-----\n"), "-----BEGIN RSA PRIVATE KEY-----\n"), "\n", "")
  comment              = "SNOWFLAKE"
  edition              = "BUSINESS_CRITICAL"
  email                = "[email protected]"
  first_name           = "First"
  last_name            = "Last"
  name                 = upper(each.value)
  region               = "AWS_US_EAST_1"

  lifecycle {
    ignore_changes = [
      comment
    ]
  }
}


Additional context

Note that when I run the same query as described in the error message (SHOW ORGANIZATION ACCOUNTS LIKE 'ABC12345') in the Snowflake console, it returns the expected results (1 row). And the is_org_admin column evaluates to false.

And this Terraform code has been working fine for us for many months, this seemingly just broke randomly.

@jrobison-sb jrobison-sb added the bug Used to mark issues with provider's incorrect behavior label Mar 7, 2023
@linkages
Copy link

linkages commented Mar 7, 2023

I am having the same problem.
Came in this morning to add some more roles to an existing account and ran into the same issue.

Terraform version:
1.3.9 and 1.1.9

Providers:
0.56.4 and 0.58.0

@rtdewi0
Copy link

rtdewi0 commented Mar 7, 2023

Same issue started today for me after the code has been working for weeks. Error is:

Error: error reading account: unable to scan row for SHOW ORGANIZATION ACCOUNTS LIKE 'ACCT1234' err = missing destination name is_org_admin in *[]snowflake.Account

Terraform: v1.2.1
Provider versions: 0.56.3 and 0.58.0

@linkages
Copy link

linkages commented Mar 7, 2023

I've opened a support case with Snowflake and pointed them at this issue for some extra context.

@rtdewi0
Copy link

rtdewi0 commented Mar 7, 2023

I just noticed that according to QUERY_HISTORY_BY_USER in Snowflake the "SHOW ORGANIZATION ACCOUNTS..." statement was working until this morning. I also noticed that according to QUERY_HISTORY_BY_USER the RELEASE_VERSION went from 7.6.4 to 7.7.4 between the time the query worked and now when it does not.

I will open a ticket with Snowflake support as well.

@rtdewi0
Copy link

rtdewi0 commented Mar 7, 2023

Per this link, this issue was introduced in the 2023_01 bundle: SHOW-ORGANIZATION-ACCOUNTS-New-Column-in-Output

Snowflake support gave us this as a temporary workaround until a fix for the provider can be made:

SELECT SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE('2023_01');

@dstuck
Copy link

dstuck commented Mar 10, 2023

Hitting this same issue. I suspect the fix is adding

	IsOrgAdmin                        sql.NullString `db:"is_org_admin"`

to this account struct:

OldAccountURL sql.NullString `db:"old_account_url"`

@sfc-gh-ngaberel
Copy link
Contributor

Hi everyone, as you suspected this bug was introduced by the addition of the is_org_admin column in SHOW ORGANIZATION ACCOUNTS in this month's behavior change release of Snowflake. The fix is in main and will be available in the next release of the provider.
We're looking at ways to detect these API changes earlier internally so we can keep the provider up to date with the future Snowflake releases and prevent this type of issues in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior
Projects
None yet
5 participants