terraform: write lock on post state updates
terraform: write lock on post state updates

Found race here: https://travis-ci.org/hashicorp/terraform/builds/177814212

Since WriteState calls `prune` and `init`, we're actually modifying the
state structure so we need a full write lock to perform this operation.

hashicorp/terraform-plugin-sdk,hashicorp/terraform-plugin-sdk