Snowflake-Labs / terraform-provider-snowflake

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

Import failing with remote backend #563

Closed dstuck closed 3 years ago

dstuck commented 3 years ago

Provider Version v0.23.2

Terraform Version v0.12.31

Describe the bug Run terraform import (I've tried with schemas and with storage integrations) and while the planning portion of the import, the refreshing state portion fails to pass the account information to the

Expected behavior Expect the existing resources to be imported

Code samples and commands

terraform import 'module.datapipeline-snowflake.snowflake_storage_integration.aws_export[0]' CUST_PROD_AWS_INGEST

Acquiring state lock. This may take a few moments...
module.datapipeline-snowflake.snowflake_storage_integration.aws_export[0]: Importing from ID "CUST_PROD_AWS_INGEST"...
module.datapipeline-snowflake.snowflake_storage_integration.aws_export[0]: Import prepared!
  Prepared snowflake_storage_integration for import
module.datapipeline-snowflake.snowflake_storage_integration.aws_export[0]: Refreshing state... [id=CUST_PROD_AWS_INGEST]

Error: could not build dsn for snowflake connection: 260000: account is empty
Error: could not build dsn for snowflake connection: 260000: account is empty

From the debug logs, the portion that seems to fail is running query stmt SHOW STORAGE INTEGRATIONS LIKE 'CUST_PROD_AWS_INGEST' which never authenticates and raises the error

Additional context We're using an s3 backend and successfully running terraform applies in multiple places.

dstuck commented 3 years ago

It turns out that this was a problem with configuration related to new versions of terraform. We were defining providers in a module which is being deprecated. It should still be supported in v0.12 but we want to switch over to be v0.13 compliant anyway so won't raise any concerns with terraform developers here.