terraform-provider-snowflake: Database resources error after upgrade to 0.6.2
Provider Version 0.62.0
Terraform Version 1.4.5
Describe the bug
After upgrading the Terraform plugin from version 0.56.2, I get the following exception.
Error: unable to scan row for SHOW DATABASES LIKE 'TEST' err = missing destination name resource_group in *[]snowflake.Database
│
│ with snowflake_database.databases["TEST"],
│ on databases.tf line 51, in resource "snowflake_database" "databases":
│ 51: resource "snowflake_database" "databases" {
│
╵
Removing the state and re-importing doesn’t help.
Terraform used to generate the databases:
locals {
databases = {
# Environments
"PRODUCTION" = {
data_retention_time_in_days = 14
}
"TEST" = {
data_retention_time_in_days = 1
}
}
resource "snowflake_database" "databases" {
provider = snowflake.sysadmin
for_each = local.databases
name = each.key
comment = lookup(each.value, "comment", null)
data_retention_time_in_days = lookup(each.value, "data_retention_time_in_days", 3)
lifecycle {
prevent_destroy = true
}
}
We’ve been struggling ever since version 0.56.3 to upgrade because of issues with the databases. Versions previous to 0.62.0 remove all databases from the state. When trying to re-import them we get the following:
snowflake_database.databases["TEST"]: Refreshing state... [id=TEST]
╷
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to "snowflake_database.databases[\"TEST\"]", the provider detected that no object exists with the given id.
│ Only pre-existing objects can be imported; check that the id is correct and that it is associated with the provider's configured region or endpoint, or
│ use "terraform apply" to create a new remote object for this resource.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 5
- Comments: 17 (4 by maintainers)
@douglaszickuhr you’ll probably want to re-enable the 2023_03 bundle once you’ve upgraded, I suggest getting in touch with support to confirm the process.
@mlavaert I have a simiar issue as @christyvp
Even on
0.64.0I get the following error when creating a database from a replica@mlavaert I have tried to update to 0.64.0 and the issue has not been resolved. I opened another ticket here, per enterprise support and my account team: https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/1774
I am getting this error as well with provider version 0.63.0.