title: How can I reference a variable in `main.tf`?
body: <p>I have two terraform files <code>main.tf</code> and <code>var.tfvars</code>:</p>
  <p>main.tf:</p>
  <pre><code>provider &quot;google&quot; {
    project = var.project_id
    region  = var.gcp_region
  }
  
  provider &quot;aws&quot; {
    region = var.aws_region
      alias = &quot;aws&quot;
  }
  
  </code></pre>
  <p>vars.tfvars:</p>
  <pre><code>variable &quot;gcp_region&quot; {
      type = string
      default = &quot;asia-southeast1&quot;
  }
  
  variable &quot;aws_region&quot; {
      type = string
      default = &quot;ap-southeast-2&quot;
  }
  
  variable &quot;project_id&quot; {
      type = string
      default = &quot;test-oidc-arosha&quot;
  }
  </code></pre>
  <p>when I run <code>terraform apply</code>, I got below error:</p>
  <pre><code>Error: Reference to undeclared input variable
  │
  │   on local.tf line 6, in locals:
  │    6:     state_backet = &quot;${local.component_name}-${local.part_name}-deployment-${var.aws_region}-${data.aws_caller_identity.current.account_id}&quot;
  │
  │ An input variable with the name &quot;aws_region&quot; has not been declared. This variable can be declared
  │ with a variable &quot;aws_region&quot; {} block.
  ╵
  ╷
  │ Error: Reference to undeclared input variable
  │
  │   on main.tf line 2, in provider &quot;google&quot;:
  │    2:   project = var.project_id
  │
  │ An input variable with the name &quot;project_id&quot; has not been declared. This variable can be declared
  │ with a variable &quot;project_id&quot; {} block.
  ╵
  ╷
  │ Error: Reference to undeclared input variable
  │
  │   on main.tf line 3, in provider &quot;google&quot;:
  │    3:   region  = var.gcp_region
  │
  │ An input variable with the name &quot;gcp_region&quot; has not been declared. This variable can be declared
  │ with a variable &quot;gcp_region&quot; {} block.
  </code></pre>
  <p>I don't understand why I got this error even I already specified the default values for each variable.</p>
  <p>My terraform version is:</p>
  <pre><code>$ terraform --version
  Terraform v1.0.0
  on darwin_amd64
  + provider registry.terraform.io/hashicorp/aws v3.45.0
  + provider registry.terraform.io/hashicorp/google v3.72.0
  </code></pre>