Skip to content

Commit

Permalink
Update outputs.tf
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleKotowick committed Sep 10, 2024
1 parent fb1e1f7 commit 5b959a2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,22 @@ output "delete_after" {
// Outputs generated by this module
//==================================================
locals {
// Will always be `true` because jsonencoding a data source will
// This will always be `true` because jsonencoding a data source will
// never return an empty string, but this forces it to wait
// until the data source is done before evaluating.
creation_done = jsonencode(data.external.create_file_chunk) != "" ? true : false
// The MD5 encoding is required to force Terraform to actually wait
// until the value is fully available; otherwise, it will apparently
// do some preemptive checks to evaluate the ternary early.
creation_done = md5(jsonencode(data.external.create_file_chunk)) != md5("") ? true : false
deletion_done = length(data.external.delete_file) == 0 ? true : md5(jsonencode(data.external.delete_file[0])) != md5("")
}

output "created" {
depends_on = [
data.external.create_file_chunk,
]
description = "Always `true`, but does not return until the file has been created."
value = jsonencode(data.external.create_file_chunk) != "" ? true : false
value = local.creation_done
}

output "complete" {
Expand All @@ -78,7 +82,7 @@ output "complete" {
data.external.delete_file,
]
description = "Always `true`, but does not return until the file has been created and, if desired, deleted as well."
value = length(data.external.delete_file) > 0 ? (sha256(jsonencode(data.external.delete_file[0])) != sha256("") ? true : false) : jsonencode(data.external.create_file_chunk) != "" ? true : false # TODO: switch to local val
value = local.creation_done ? local.deletion_done : false
}

output "num_chunks" {
Expand Down

0 comments on commit 5b959a2

Please sign in to comment.