Open myoung34 opened 6 years ago
if you run tf output
in the folder containing the config for the remote state, do you see those outputs? If not, you haven't ran an apply or refresh since adding them, so they are not in the remote state file.
The error only appears to happen when the state is empty (the output is from our jenkins build to rebuild staging from nothing)
This seems to work as expected in current testing with the resources all existing, but seems to fail when the state is essentially empty
that makes sense. when terraform queries a remote state, it doesn't run any of the resources, so if there isn't an output block in the statefile, it doesn't know about any outputs.
@bdashrad got around to testing, using terraform refresh --var.....
before -target
fixes the issue, although its still strange to have to refresh outputs when there arent any before targeting resources
I have same issue here. running TF version 0.11.10. I have run similar target modules and have never came across this issue. Not exactly sure why just started happening. terraform refresh
resolve the issue here. Anyways, there should be no need to run a refresh, it should auto refresh when running apply or plan.
Terraform Version
0.10.6
Affected Resource(s)
Terraform Configuration Files
in a remote state:
In a top level tf:
Debug Output
On the tf with outputs, apply works and shows the outputs:
Using
terraform apply -target=module.rds
fails and never attempts to look up the remote state outputs:You can see it never did any look ups. Running the same command with no
-target=...
works exactly as expected:Expected Behavior
Able to target resources/modules individually
Actual Behavior
What actually happened?
Steps to Reproduce
See debug output
Important Factoids