On Windows 10 I'm trying to build this Project on GitHub: https://github.com/mathspace/terraform-aws-ecr-docker-image
It fails with this error:
Error: External Program Execution Failed
│
│ with data.external.hash,
│ on push.tf line 3, in data "external" "hash":
│ 3: program = [coalesce(var.hash_script, "C://VS//terraform-aws-ecr-docker-image//hash.sh"), var.source_path]
│
│ The data source received an unexpected error while attempting to execute the program.
│
│ Program: C://VS//terraform-aws-ecr-docker-image//hash.sh
│ Error: fork/exec C://VS//terraform-aws-ecr-docker-image//hash.sh: %1 is not a valid Win32 application.
I'm stumped as to what the problem is with the External Hash being generated?
It's a clone of this popular Git Repo so unless something changed in the last few years it doesn't work - despite 26 stars.
This is the code, hardcoding the Module's Path didn't make any difference:
# Calculate hash of the Docker image source contents
data "external" "hash" {
program = [coalesce(var.hash_script, "${path.module}/hash.sh"), var.source_path]
}
# Build and push the Docker image whenever the hash changes
resource "null_resource" "push" {
triggers = {
hash = data.external.hash.result["hash"]
}
provisioner "local-exec" {
command = "${coalesce(var.push_script, "${path.module}/push.sh")} ${var.source_path} ${aws_ecr_repository.repo.repository_url} ${var.tag}"
interpreter = ["bash", "-c"]
}
}