terraform-provider-snowflake icon indicating copy to clipboard operation
terraform-provider-snowflake copied to clipboard

unable to import snowflake_stage resource

Open jnichols3 opened this issue 4 years ago • 3 comments

We are trying to import some existing snowflake_stage resources that were setup manually in snowflake.

terraform code:

resource "snowflake_stage" "test_stage" {
  name        = "TEST_STAGE"
  database    = "TEST_DB"
  schema      = "PUBLIC"
  file_format = "TYPE = JSON"
  url         = "s3://kafka-s3-bucket/topics/test/"
  credentials = "AWS_KEY_ID = 'abcd' AWS_SECRET_KEY = '1234'"
}

when we run the import we get an error:

$ terraform import snowflake_stage.test_stage TEST_STAGE
snowflake_stage.test_stage: Importing from ID "TEST_STAGE"...
snowflake_stage.test_stage: Import prepared!
  Prepared snowflake_stage for import
snowflake_stage.test_stage: Refreshing state... [id=TEST_STAGE]

Error: 3 fields allowed

Are imports supported for this resource?

jnichols3 avatar Jul 15 '20 19:07 jnichols3

this looks to be a similar issue as in https://github.com/chanzuckerberg/terraform-provider-snowflake/issues/113 I was able to import a snowflake_stage by specifying the full ID/path of the resource:

terraform import snowflake_stage.test_stage "<database_name>|<schema_name>|<stage_name>"

the import syntax should be documented in a way similar to how hashi does it in the official terraform docs. I took a stab at this in PR: https://github.com/chanzuckerberg/terraform-provider-snowflake/pull/223

jnichols3 avatar Jul 15 '20 22:07 jnichols3

Hello @jnicholsthru . Thanks to your post, I was able to import successfully my stages, thanks.

Did you have any problems creating new ones? I can't do it and I am wondering whether it is a bug or I am doing something wrong

JavierLopezT avatar Nov 18 '20 14:11 JavierLopezT

@JavierLopezT what problems are you having?

ryanking avatar Dec 11 '20 22:12 ryanking

We are closing this issue as part of a cleanup described in announcement. If you believe that the issue is still valid in v0.89.0, please open a new ticket.

sfc-gh-asawicki avatar Apr 30 '24 17:04 sfc-gh-asawicki