Skip to content

Commit

Permalink
docs: remove if exist from example. since default terraform behavior …
Browse files Browse the repository at this point in the history
…is to fail when the resource already exists. instead i updated the import section to include an example using idempotent snowsql clauses.
  • Loading branch information
aidanmelen committed Mar 1, 2023
1 parent d75cc45 commit 7a51931
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions docs/resources/exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,22 +264,22 @@ In addition to all arguments above, the following attributes are exported:

## Import

Import is supported using the following syntax:
Import is partially supported using the following syntax:

```shell
terraform import snowsql_exec.name name
```

However, since the default method only imports the object without controlling the read/refresh logic, it is recommended to use snowflake clauses to interact with existing objects, such as:
However, we recommend using idempotent SnowSQL clauses when interacting with existing objects, such as:

```terraform
resource "snowsql_exec" "role" {
create {
statements = "CREATE ROLE my_role"
statements = "CREATE ROLE IF NOT EXISTS my_role"
}
delete {
statements = "DROP ROLE my_role"
statements = "DROP ROLE IF EXISTS my_role"
}
}
```
4 changes: 2 additions & 2 deletions examples/resources/exec/basic/.import.tf.docs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
resource "snowsql_exec" "role" {
create {
statements = "CREATE ROLE my_role"
statements = "CREATE ROLE IF NOT EXISTS my_role"
}

delete {
statements = "DROP ROLE my_role"
statements = "DROP ROLE IF EXISTS my_role"
}
}
2 changes: 1 addition & 1 deletion templates/resources/exec.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@ Import is supported using the following syntax:
terraform import snowsql_exec.name name
```

However, since the default method only imports the object without controlling the read/refresh logic, it is recommended to use snowflake clauses to interact with existing objects, such as:
However, we recommend using idempotent SnowSQL clauses when interacting with existing objects, such as:

{{ tffile "examples/resources/exec/basic/.import.tf.docs" }}

0 comments on commit 7a51931

Please sign in to comment.