terraform-provider-snowflake: err = missing destination name kind in *[]snowflake.Database
Provider Version
0.64
Terraform Version
1.4.6
Describe the bug Snowflake release 7.13 adds the kind column to the show databases command. This behavior change was enabled by default in the 7.19 release:
select current_version();
-- +-------------------+
-- | CURRENT_VERSION() |
-- |-------------------|
-- | 7.19.2 |
-- +-------------------+
I believe this is now causing the state refresh for our existing databases to fail:
Error: unable to scan row for SHOW DATABASES LIKE 'ANALYTICS' err = missing destination name kind in *[]snowflake.Database
with snowflake_database.analytics,
on databases.tf line 1, in resource "snowflake_database" "analytics":
1: resource "snowflake_database" "analytics" {
Expected behavior
The state of the database refreshes successfully.
Code samples and commands
resource "snowflake_database" "analytics" {
name = "ANALYTICS"
data_retention_time_in_days = 14
is_transient = false
}
Additional context A patch for this change would be appreciated. In particular, https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/1845 is a major friction to us upgrading beyond 0.64.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 22
- Comments: 36 (5 by maintainers)
Snowflake seems to have enabled bundle 2023_03 this week which is now in “opt-out period”.
In this bundle, there is a change on the SHOW DATABASES command which has a new colmun named KIND (more info on snowflake documentation). I suppose that this change is at the origin of our problems.
For my part, I have disabled this bundle and trouble was solved for us. Command to disable the bundle :
select SYSTEM$DISABLE_BEHAVIOR_CHANGE_BUNDLE('2023_03');Nevertheless, bundle will be enable by default in 2 months (without possibility to disable it) so I think that we will have to upgrade to a new release of the provider and for my part, I hope that issue #1845 will be solved…
In case anyone is interested, we managed to get around any grant revokes by doing this:
just to be sure we additionally included the ingnore_changes = [users] as was mentioned here
@sfc-gh-swinkler We also cannot upgrade to 0.66 as #1845 breaks our setup. Among other things, all the grants performed by AzureAD are dropped.
This started effecting us today on 0.64
@sfc-gh-swinkler are there any plans to resolve #1845? This issue complicates upgrading from 0.64 to later versions.
Hitting the same issue on 0.63
Hi @sfc-gh-swinkler - thanks for approving #1872. A common pain-point from this thread is that several teams (myself included) can’t upgrade to version 0.65+ because of #1845. So if that issue won’t be resolved soon, is it possible to release something like a v0.64.1 that just adds the change from #1872 into 0.64.0, so that teams can use their current provider versions in the meantime?
Same to us. Without any change in the terraform config or in the snowflake platform ( current snowflake version 7.20.0)
0.61 provider version
with 0.61 current provider version, db’s are not recognized anymore . And it tries to create them:
0.65 provider version
with 0.65 provider version this error happens.
> 0.66 provider version
with 0.66.1 and 0.66.2 db problem seems to be fixed but now it want to change role_grants config .
It is adding a new parameter
enable_multiple_grants = trueand also trying to remove some of the users belonging to the role. This is a very big trouble.#1872 should fix it
same issue 0.61
As a work around, we have disabled bundle 2023_03 which appears to have resolved the issue for now:
Assuming this is fixed in a release before the opt out period has ended, we ideally would prefer to not have to remove and re-import most of the role grants in our account from terraform state to upgrade (https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/1845).
In my current configuration we don’t use terraform to provision real users ( we have an Azure AD integration to automatically provision real users from the Azure AD ).
In this context, as a workaround to avoid removing users in the next
terraform applyI’ve changed mysnowflake_role_grantsresource definition addingenable_multiple_grants = falseand a ignore_changes for users in a lifecycle blockI hope this can help to other administrators in a similar context. ( maybe won’t be a good workaround if this terraform config is used also to provision generic services users for external tooling connection, something I will need in the future)
Same same
Upgrading to 0.66.1 solved the issue for us.
i upgraded to 0.66.1 still not working. Everything was fine yesterday, stopped working today. terraform plan doesn’t recognize dbs already exist.
This was fixed in 0.66 as part of the databases SDK refactoring: https://github.com/Snowflake-Labs/terraform-provider-snowflake/pull/1840. Essentially the driver we were using was throwing an error when a field wasn’t found in the scanned struct. We have changed that to not throw an error. If this field isn’t found, it will just set it to an empty string. Furthermore, we did add “Kind” https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/pkg/sdk/databases.go#L571.
Please let me know after upgrading to 0.66 if this is still an issue and i would be happy to work with you to resolve it.