Problems using CustomizeDiff with calculated fields #548
Labels
bug
Something isn't working
subsystem/types
Issues and feature requests related to the type system of Terraform and our shims around it.
SDK version
Relevant provider source code
Terraform Configuration Files
Initial Configuration
Updated Configuration
Debug Output
Crash Log: https://gist.github.com/yoink00/09ae6424b6d0a468aca49dba10935259
Expected Behavior
Changing the
network
attribute in the existingnetwork_interface
list element should force a newupcloud_server
resource.The
CustomizeDiff
function is attempting to detect a few scenarios where we know we need to re-create the resource: a) when we've removed an item from the list b) any of the items in the list have certain fields changed or c) the order of the list has changed.This code mostly works in manual and automated tests. The
network
field is the ID of a separateupcloud_network
resource. If the creation of that resource happens during the same plan/apply as changing the value ofnetwork
then the provider crashes (i.e. thenetwork
ID is not yet known). If the new ID is known (i.e. the new network was created during a previous apply) it does not crash.Actual Behavior
The provider crashes. The crash appears to be happening in line 796 of
grpc_provider.go
here (atif v.NewExtra != nil {
):Sticking in a debug
Printf
we can see that the value ofnetwork
isnil
:Steps to Reproduce
terraform apply ; # with initial configuration
terraform apply ; # with configuration updated to add new network and use ID in exsiting server
References
Forum discussion [https://discuss.hashicorp.com/t/problems-using-customizediff-with-calculated-fields/13251/3]
The text was updated successfully, but these errors were encountered: