In terraform 0.12, it appears that provider plugins are closed as soon as their resources and data sources in the apply graph are complete.
terraform-provider-ssh was relying on the previous behavior and launching a goroutine to maintain each SSH connection it created for the purposes of local forwarding.
Is there a viable way to do this in terraform 0.12? @stefansundin was thinking of forking a child process to maintain connections and using inter-process communication from the provider plugin to that process. That seems like it might be viable at first glance to me but adds a lot of programming overhead compared to using goroutines/channels.
The tricky bit here is that other resources will depend on
data_source_ssh_tunnel. Those resources are waiting on
data_source_ssh_tunnel to be created to signal that the tunnel is ready. Even if it were possible to wait for the completion of dependent resources (AFAIK it’s not) there’s still no easy way to keep a goroutine running until their completion.
Just looking for guidance on whether there might be a viable path here for a provider or whether I should redirect my effort towards landing this in core.