Terraform plan error - Missing Expected {

Dear Users,

I am using terraform 0.14.3 with custom provider to manage resources on on-perm infrastructure. Things are running fine as long as I am running Terraform to store state locally. However, when I switch to PG as backend, it gives me an error on plan:

Error: Missing Expected {

Below is how i am using PG configuration:

terraform {
   required_providers {
       mycloud = {
         source = "terraform.provider/proj/cloud"
         version = "0.0.x"
      }
   }

  backend "pg" {
       conn_str = "postgres://connection.url.for.postgres"
  }
}

Again if I remove the backend config, it works fine.

Hi @Pushp1403!

Is there anything else in the .tf file that contains this terraform block? I wonder if something elsewhere in the file is causing Terraform’s parser to get confused.

It would also help if you could share the full error message, rather than just the summary, so that I can see specifically which part of this file the parse error is referring to.