Answers: <h1>Because you made it a variable!</h1>
  <p>This one confused me for a minute too.  Your <code>locals</code> are defined correctly.  You reference it correctly.  So why is terraform prompting for it?  Just because you define it as a variable.</p>
  <p>Since you're not using <code>var.certificate_arn</code> anywhere, defining it is a variable is not needed.  But since you did define it as a variable, terraform is going to diligently ask for it.  Getting rid of the variable definition should fix your issue.</p>
  <p>If later you want to turn it into a variable, fine.  But you'll need to get rid of the local and reference <code>var.</code> instead of <code>local.</code>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-09-28T16:31:53.250Z
Answers: AH. I saw somewhere that variables.tf is for declaring and locals.tf is for assigning. I will have to find that question and update it with your answer! Thanks!
Answers: James Geddes
Answers: CC BY-SA 4.0
Answers: 2021-09-28T16:33:03.600Z
Answers: You can put it all in the same file too.  Terraform doesn't care much what the files are named.
Answers: chicks
Answers: CC BY-SA 4.0
Answers: 2021-09-28T16:30:09.453Z
Answers: 2021-09-28T16:30:09.453Z
Answers: chicks
Body: <p>Here are my files so far.</p>
  <h2>main.tf</h2>
  <pre><code>data &quot;my_vars&quot; &quot;vars&quot; {
      certificate_arn = local.certificate_arn
  }
  </code></pre>
  <h2>variables.tf</h2>
  <pre><code>variable &quot;certificate_arn&quot; {
      description = &quot;The ARN for the certificate&quot;
      type = string
  }
  </code></pre>
  <h2>locals.tf</h2>
  <pre><code>locals {  
      certificate_arn = &quot;foo&quot;
  }
  </code></pre>
  <p>When I run a plan, Terraform asks me for the value of <code>certificate_arn</code>, however as far as I can see it is set in locals. What am I missing here?</p>
  
Tags: <terraform>
Title: Why is Terraform not picking up locals.tf?
UserDisplayName: James Geddes
ThreadText: # Why is Terraform not picking up locals.tf?
  
  (Asked by: username_0 on 2021-09-28)
  
  Here are my files so far.
  
  ## main.tf
  
  ```
  data "my_vars" "vars" {
      certificate_arn = local.certificate_arn
  }
  
  ```
  
  ## variables.tf
  
  ```
  variable "certificate_arn" {
      description = "The ARN for the certificate"
      type = string
  }
  
  ```
  
  ## locals.tf
  
  ```
  locals {  
      certificate_arn = "foo"
  }
  
  ```
  
  When I run a plan, Terraform asks me for the value of `certificate_arn`, however as far as I can see it is set in locals. What am I missing here?
  
  **Tags:** terraform
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-09-28. Score: 2 | Accepted answer
  
  # Because you made it a variable!
  
  This one confused me for a minute too. Your `locals` are defined correctly. You reference it correctly. So why is terraform prompting for it? Just because you define it as a variable.
  
  Since you're not using `var.certificate_arn` anywhere, defining it is a variable is not needed. But since you did define it as a variable, terraform is going to diligently ask for it. Getting rid of the variable definition should fix your issue.
  
  If later you want to turn it into a variable, fine. But you'll need to get rid of the local and reference `var.` instead of `local.`.
  
  > **Comments:**
  > **username_0**: AH. I saw somewhere that variables.tf is for declaring and locals.tf is for assigning. I will have to find that question and update it with your answer! Thanks!  
  > **username_1**: You can put it all in the same file too.  Terraform doesn't care much what the files are named.  
  
  ---
  
  