I am using Terraform version 0.12.7 .
I am facing error " Error:rpc error: code = Internal desc = grpc: error while marshaling: proto: field “tfplugin5.ProvisionResource.Response.Output” contains invalid UTF-8"
This error I did not face before, suddenly i have started getting this error.
Now I find a github link where it is fixed in version 0.12.14
I don’t want to upgrade my terraform, so is there a workaround available to handle this error in version 0.12.7 only?
I am sorry, but by making a choice to continue using this ancient version, you have made a choice to deny yourself bug fixes, and inflict this problem upon yourself.
I suppose you could consider changing your provisioner to not return invalid UTF-8.
But in my opinion, the real issue you need to solve, is the refusal to upgrade.
Yes, I totally agree. Its just that I have a hard dependency right now. We are planning to upgrade terraform in some time though.
Also I am just trying to install virtualenv , and at that point in between I get this error
As @maxb suggested, I think the root problem here is that the program you are running (with remote-exec or local-exec, presumably) is writing non-UTF-8 text in its output, whereas Terraform typically expects all strings to be valid UTF-8.
If you cannot upgrade Terraform then the only workaround I can think of would be to change the program you are running to produce only valid UTF-8 output. It sounds like the program you are running is not directly under your control – I assume you mean Python virtualenv, which presumably means you’re running its installer that wasn’t written by you – but you could perhaps redirect its output to a file on disk or to /dev/null or nul: (depending on which OS you are using) so that Terraform will not try to parse and display that output.
Of course that does mean that if the installation fails then you will only see that it returned an unsuccessful exit code, and you won’t also see the command output. At least while you are still developing this I would suggest redirecting to a file so that you can at least refer to that file to see what happened.
Upgrading from Terraform v0.12.7 to the latest release in the v0.12.x series should be relatively straightforward since there are typically only low-risk bugfixes in patch releases. It would still be a good idea to upgrade to the latest minor release since v0.12 is very old and unsupported now, but at least if you can upgrade to the very latest v0.12.x then you should benefit from the fix you found on GitHub.