Open mootari opened 1 year ago
@mootari Thanks for reporting this. I will look into this. Am I correct to assume the expected behavior here is for the read query to not flop on a null value, and proceed to execute the mutation to re-populate the value?
@sullivtr Yes, I think that's accurate. Thank you!
@mootari In the meantime, it seems like setting compute_from_create
to true would benefit you here (assuming the graphql response from your create mutation would return the most accurate representation of this data). This is still a bug I need to fix, but this could be a workaround for you in the meantime.
I have the same issue, even if I use compute_from_create
, error shows
panic: interface conversion: interface {} is float64, not string
@sullivtr, I am also running into the computer_from_create
error. Is this something you have time to look into?
Hi folks, I believe that #96 by @dlecocq should be a fix for this issue, at least for non-string values such as float64 and integers. Released in v2.5.5
I was testing the resilience of my
graphql_mutation
resource by deallocating a resource externally and then runningterraform apply
again. Unfortunately the plugin crashes when one of the to-be-mapped values in the read_query response is null.Given the following provider resource
and the state
(show state)
~~~hcl resource "graphql_mutation" "fly_ipv4_shared" { compute_mutation_keys = { "appId" = "app.id" "ip" = "app.sharedIpAddress" } computed_delete_operation_variables = { "appId" = "my-app-id" "ip" = "66.241.124.84" } computed_read_operation_variables = { "appId" = "my-app-id" "ip" = "66.241.124.84" } computed_update_operation_variables = { "appId" = "my-app-id" "ip" = "66.241.124.84" } create_mutation = "mutation ($appId: ID!) { allocateIpAddress(input: {appId: $appId, type: shared_v4}) { app { sharedIpAddress } } }" delete_mutation = "mutation ($appId: ID!, $ip: String!) { releaseIpAddress(input: {appId: $appId, ip: $ip}) { clientMutationId } }" enable_remote_state_verification = true existing_hash = "1025037459" force_replace = false id = "1025037459" mutation_variables = { "appId" = "my-app-id" } query_response = jsonencode( { data = { app = { id = "my-app-id" sharedIpAddress = "66.241.124.84" } } } ) query_response_input_key_map = { "appId" = "app.id" } read_query = "query ($appId: String!) { app(name: $appId) { id, sharedIpAddress } }" read_query_variables = { "appId" = "my-app-id" } update_mutation = "mutation ($appId: ID!) { allocateIpAddress(input: {appId: $appId, type: shared_v4}) { app { sharedIpAddress } } }" } ~~~if on the next run the read_query response has the shape
then the plugin crashes in
computeMutationVariableKeys
with the following error and trace: