Terraform Version
0.10.4
Terraform Configuration Files
data "external" "foo" {
depends_on = ["null_resource.test"]
program = ["bash", "${path.module}/test.sh"]
}
resource "null_resource" "test" {
}
output "foo" {
value = "${data.external.foo.result["foo"]}"
}
(test.sh)
#!/bin/bash
jq -n --arg foo "bar" '{"foo":$foo}'
Expected Behavior
terraform plan -detailed-exitcode should return 0 in this case.
Actual Behavior
it's returning 2
> terraform plan -detailed-exitcode
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
null_resource.test: Refreshing state... (ID: 910628614195011957)
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
<= read (data resources)
Terraform will perform the following actions:
<= data.external.foo
id: <computed>
program.#: "2"
program.0: "bash"
program.1: "/Users/slee1/tmp/tf/ext-prov-detailed-exitcode/test.sh"
result.%: <computed>
Plan: 0 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
> echo $?
2
Steps to Reproduce
terraform init
terraform apply
terraform plan -detailed-exitcode
echo $?
Notes
If depends_on is removed from the external provider stanza, then the exit code becomes 0. However, that is not a viable workaround when depends_on is actually necessary.
Terraform Version
0.10.4Terraform Configuration Files
(test.sh)
Expected Behavior
terraform plan -detailed-exitcodeshould return 0 in this case.Actual Behavior
it's returning 2
Steps to Reproduce
terraform initterraform applyterraform plan -detailed-exitcodeecho $?Notes
If
depends_onis removed from the external provider stanza, then the exit code becomes 0. However, that is not a viable workaround whendepends_onis actually necessary.