The snowsql_exec resource supports an optional read block which will return a JSON encoded string containing the query result set(s). When the read block is not specified, attribute is a non-json decodable empty string which will fail to decode with the jsondecode() terraform function.
Affected Resource(s)
Please list the resources as a list, for example:
snowsql_exec
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
resource "snowsql_exec" "role" {
name = "my_role"
create {
statements = "CREATE ROLE IF NOT EXISTS my_role"
}
delete {
statements = "DROP ROLE IF EXISTS my_role"
}
}
output "show_role_results" {
description = "The SnowSQL query result from the read statements."
value = jsondecode(nonsensitive(snowsql_exec.role.read_results))
}
Error Output
╷
│ Error: Error in function call
│
│ on outputs.tf line 3, in output "show_role_results":
│ 3: value = jsondecode(nonsensitive(snowsql_exec.role.read_results))
│ ├────────────────
│ │ snowsql_exec.role.read_results has a sensitive value
│
│ Call to function "jsondecode" failed: EOF.
╵
Expected Behavior
That read_results is a empty JSON encoded list so that the jsondecode doesn't failed on a empty string.
> jsondecode("null")
null
Actual Behavior
We are essentially doing this:
> jsondecode("")
╷
│ Error: Error in function call
│
│ on <console-input> line 1:
│ (source code not available)
│
│ Call to function "jsondecode" failed: EOF.
╵
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
jsondecode read_results.
terraform apply with the read block not specified.
The
snowsql_exec
resource supports an optionalread
block which will return a JSON encoded string containing the query result set(s). When theread
block is not specified, attribute is a non-json decodable empty string which will fail to decode with thejsondecode()
terraform function.Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Error Output
Expected Behavior
That
read_results
is a empty JSON encoded list so that the jsondecode doesn't failed on a empty string.Actual Behavior
We are essentially doing this:
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
jsondecode
read_results.terraform apply
with theread
block not specified.