Snowflake-Labs / terraform-provider-snowflake

Terraform provider for managing Snowflake accounts
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest
MIT License
554 stars 422 forks source link

Cannot add or remove more than 10 accounts to a share at once #2189

Open emancu opened 1 year ago

emancu commented 1 year ago

Provider Version

0.72.0

Terraform Version

1.4

Describe the bug

It is not a bug, its a limitation on the API. The problem is, there is no way in terraform to add multiple accounts to a single share.

resource "snowflake_share" "insights_for_partners_reporting" {
  name    = upper("insights_${var.environment}")
  comment = "This share is meant to be used by the Reader accounts to access reports."

  # FIXME: Snowflake provider won't fetch more than 3 accounts, although it is updated.
  # https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/1066
  # 
  # Another error, Snowflake provider can't assign more than 10 accounts simultaneously!
  accounts = local.all_reader_accounts
}

Gives the following error:

│ Error: 003517 (0A000): SQL compilation error:
│ Cannot add or remove more than 10 accounts to a share at once.

Expected behavior

The provider generates the query using ADD ACCOUNTS, which technically it is prepared to append accounts without removing existing ones; however there is no way to iterate over accounts and append them to the share using terraform when there are more than 10 accounts.

I would expect a way to at least iterate over accounts using ADD ACCOUNT | REMOVE ACCOUNT.

jhughes-naic commented 6 months ago

I ran into this issue as well with provider version 0.87.2. I have a share with well over 10 accounts attached and see no way with Terraform to iterate through the accounts. The "10 account limit" appears to be a Snowflake limit, I get the same message in the WebUI, however the Terraform provider should account for this.

sfc-gh-asawicki commented 6 months ago

Hey @jhughes-naic. Thanks for reaching out to us.

We have this issue listed for https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#preparing-the-rest-of-the-fundamental-ga-objects-for-the-provider-v1 (https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/v1-preparations/REMAINING_GA_OBJECTS.MD).

CameronGibson commented 1 week ago

I am also running into this issue as well. I cannot find away around it either. Even with incrementally adding 10 shares at a time.