Closed aidanmelen closed 1 year ago
terraform provider docs for import: https://developer.hashicorp.com/terraform/tutorials/providers/provider-import#implement-import
After looking further investigation, the import does work; however, it does not set any of the statements blocks. Therefore it would take either the user providing the statements in the resource id which would be gross OR we would need to know how to pull the statements from snowflake during the read which isn't going to happen.
Instead, we can customize how the create statements to behave by adding IF NOT EXIST
/OR REPLACE
. For example:
This terraform will only create the role when the role doesn't already exists:
resource "snowsql_exec" "role" {
create {
statements = "CREATE ROLE IF NOT EXISTS my_role"
}
delete {
statements = "DROP ROLE IF EXISTS my_role"
}
}
This is effectively a terraform import
.
The snowsql import does not import the resource statements correctly.
Terraform Version
n/a
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
Expected Behavior
What should have happened?
the
create
,read
, anddelete
statements should be in the resource state.Actual Behavior