-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add account data source (#3261)
### Changes - Refactor accounts data source - Adjust acceptance test - Add examples - Adjust migration guide
- Loading branch information
1 parent
211ad46
commit 6087fc9
Showing
6 changed files
with
344 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Simple usage | ||
data "snowflake_accounts" "simple" { | ||
} | ||
|
||
output "simple_output" { | ||
value = data.snowflake_accounts.simple.accounts | ||
} | ||
|
||
# Filtering (like) | ||
data "snowflake_accounts" "like" { | ||
like = "account-name" | ||
} | ||
|
||
output "like_output" { | ||
value = data.snowflake_accounts.like.accounts | ||
} | ||
|
||
# With history | ||
data "snowflake_accounts" "with_history" { | ||
with_history = true | ||
} | ||
|
||
output "with_history_output" { | ||
value = data.snowflake_accounts.like.accounts | ||
} | ||
|
||
# Ensure the number of accounts is equal to at least one element (with the use of postcondition) | ||
data "snowflake_accounts" "assert_with_postcondition" { | ||
like = "account-name" | ||
lifecycle { | ||
postcondition { | ||
condition = length(self.accounts) > 0 | ||
error_message = "there should be at least one account" | ||
} | ||
} | ||
} | ||
|
||
# Ensure the number of accounts is equal to at exactly one element (with the use of check block) | ||
check "account_check" { | ||
data "snowflake_accounts" "assert_with_check_block" { | ||
like = "account-name" | ||
} | ||
|
||
assert { | ||
condition = length(data.snowflake_accounts.assert_with_check_block.accounts) == 1 | ||
error_message = "accounts filtered by '${data.snowflake_accounts.assert_with_check_block.like}' returned ${length(data.snowflake_accounts.assert_with_check_block.accounts)} accounts where one was expected" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.