-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Computed value is not recognized as changing. Second plan/apply finds it. #15857
Comments
Here is an updated log with the error I mentioned: https://gist.github.com/zambien/b0ffa08e8a80589bc5287894d4155e64
|
Hi @zambien! Sorry this isn't working properly. It's a known (and annoying!) issue that this happens. The technical reason why is that Terraform isn't able to predict during the plan phase that the update will, as a side-effect, change the The current plan to fix this is to implement something like what's in #8769, which would then allow a provider to tell Terraform programmatically when a change to a computed attribute is expected, like this:
There is some work in this direction in #14887. Unfortunately we had to hold on that work while working on 0.10.0 but hopefully we can pick it up again before too long and get it working. In the mean time, unfortunately there isn't a great workaround 😖. Some resources work around this by marking all of their attributes as For a workaround specific to this situation, I wonder if for now the resource "apigee_api_proxy_deployment" "helloworld_proxy_deployment" {
proxy_name = "${apigee_api_proxy.helloworld_proxy.name}"
org = "${var.org}"
env = "${var.env}"
revision = "${apigee_api_proxy.helloworld_proxy.revision}"
bundle_sha = "${apigee_api_proxy.helloworld_proxy.output_sha}"
} This is similar to the workarounds used on resources such as |
Thanks @apparentlymart so much for the detailed response. I did pass in the bundle_sha as an attempt at a workaround but it was from the archive_file, not from the api_proxy and that was causing the error in my second post in this thread. I made the change to use the bundle_sha from the api_proxy and saw the same error below. Is there a way for me to catch this somehow and continue? I'm new to writing plugins so I may be missing something obvious here.
|
Hi @zambien, Sorry I missed the connection between the error you reported and adding the This error indicates that when Terraform tried to re-create the diff during the apply step it got a different result than it did during plan. This error actually makes sense since I think the difference is that in this case we would normally set the I assume this difference exists because Unfortunately I'm not sure there's a good way to work around this here 😖 . It might be that this can't be properly implemented until #8769 is complete, at which point it can be solved "properly" by telling Terraform explicitly that As a side-note: I note that in your |
Hello @apparentlymart, You are correct about the reason for the Deploy/ReDeploy/UnDeploy use cases. This is why a ForceNew won't work in this case. I will look at this a bit more to see if there is a good way to to implement a ForceNew. I think I may be able to code around it by doing some funny business in Delete and Create. Thanks for the tip on the Update and ForceNew. I had meant to go back and fix that but forgot to do it. BTW, once I get my tests written and code cleaned up, how would I go about applying to have my provider included in the terraform-providers repo? Thanks for your help! |
Also looking forward to this capability being embedded in the AWS provider. |
@apparentlymart was looking for a similar https://godoc.org/github.com/hashicorp/terraform/helper/customdiff |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I'm writing a custom provider and am finding that when an output of one resource is marked as computed the dependent resource does not get marked to change. If I run an apply after the plan is applied it will find it. In other words I have to apply twice.
Terraform Version
All versions of 9 and 10.
Currently: terraform 0.10.2
Provider Code
https://github.com/zambien/terraform-provider-apigee
Terraform Configuration Files
Debug Output
https://gist.github.com/zambien/9b0d147c93cd5d6cc29b28b0d9920a2a
Expected Behavior
The update to revision should be detected when the sha changes since the revision is a computed value.
Actual Behavior
Only the sha change is detected.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
terraform plan
# Notice that only the sha is detectedterraform apply
terraform plan
#Now the revision change is recognized.This could certainly be an issue with my provider/resource code. I've spent a lot of time debugging this and did could not see that was the case though. If I force the change by passing the sha into the deployment resource I see this:
with more error information. This lead me to believe this may in fact be a terraform bug.
The text was updated successfully, but these errors were encountered: