Identify resources not managed by Terraform? #2032
Replies: 2 comments
-
Hello @davidlee-ca, Limitations of this Provider Requirements for Creating New Terraform Resources |
Beta Was this translation helpful? Give feedback.
-
Perhaps I am misreading the question. Let me see if I understand correctly:
If this is what you are asking for, then it is not as easy of a question to answer. There would need to be some way to mark resources as being managed by Terraform. This could be in the form of a comment, or a tag, or a naming convention for the resource. As not all objects support comments, and object tagging is only possible with Enterprise Edition or higher, neither is a perfect solution. What I might do instead is run various show commands to list the IDs of the objects you are interested in, for example databases, schemas, tables etc. Then compare that list with what is in your Terraform state file. Any objects that are not in the state file are objects that need to be imported. Importing also means needing to create configuration code that represents the current state of the object. If you are using Terraform 1.15, you can try using the experimental In the future we may create a tool that can scan your entire Snowflake account, running all the necessary show commands, and generating Terraform configuration for the entire account. That way you could easily manage any account with Terraform. But that would be a long way off. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
At my company we try to manage as many "infrastructure-like" objects like databases, schema, stages, file formats, roles, service users, warehouses, and the grants to tie these together -- you get the idea.
I was wondering if anyone has a trick to identify resources that are not managed by Terraform, so we can manage that drift.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions