How to enable ssl mode in terraform pg backend and provide certs?

I am new to terraform. could someone please help me how to enable ssl mode in connection string and how to provide the certs path while using pg as terraform backend please.

I have the same question.The documentation is not clear enough about that.

Actually its enabled by default , you can provide something like that to check is it working as expected ?sslmode=require to the conn string .If you want to use mutual authentication with client cert , you need to provide the path in the conn string I suppose.Not tested it yet by myself.

Hello there,
yeah, it is working like @ScriptingWorld says.

The default sslmode is the require(theoretically),
however you can define the followings:
“require” (default), “verify-full”, “verify-ca”, and “disable”

So the configuration should be similar like this:
backend “pg” {
conn_str =

"postgres://<username>:<password>@<pqdn or IP>/<database:name>?sslmode=require"

Hope it helps for everybody.