<p><a href="https://www.terraform.io/docs/configuration/types.html" rel="nofollow noreferrer">Terraform variable type constraints</a> separate &quot;primitive&quot; types from &quot;complex&quot; types. These primitive types include strings:</p>
<blockquote>
<p>A primitive type is a simple type that isn't made from any other types. All primitive types in Terraform are represented by a type keyword. The available primitive types are:</p>
<ul>
<li>string: a sequence of Unicode characters representing some text, such as &quot;hello&quot;.</li>
<li>number: a numeric value. The number type can represent both whole numbers like 15 and fractional values such as 6.283185.</li>
<li>bool: either true or false. bool values can be used in conditional logic.</li>
</ul>
</blockquote>
<p>So, simply declaring the variable as a string, with the linebreaks in it would suffice.</p>

CC BY-SA 4.0
2019-11-11T13:36:29.013Z
2019-11-11T13:36:29.013Z
2020-06-18T08:28:10.803Z
Bruce Becker
<p>It's for the public key variable for testing lab enviroments in my variables.tf file 
I tried </p>

<p><code>&lt;&lt;EOF
the string
EOF
</code></p>

<p>but terraform dosn't seem to like that</p>

CC BY-SA 4.0
2019-11-11T10:37:15.983Z
why do you need the EOF? Can't you just add the string with linebreaks in it?
Bruce Becker
CC BY-SA 4.0
2019-11-11T11:24:35.643Z
I can for this example I was haveing issues with the key pair to do with the formating iv now resolved and thought in future it would be more efficent to use multi line to change the key more easily.
doug
CC BY-SA 4.0
2019-11-11T11:25:57.067Z
Ok. I' going to add the answer as appropriate
Bruce Becker
CC BY-SA 4.0
2020-05-11T15:17:20.717Z
I have also seen examples where you have to do:
<<-EOF
LINE DATA
EOF

note the "<<-EOF" instead of "<<EOF"
atom88
CC BY-SA 4.0
2020-05-11T15:18:49.393Z
I have also seen examples that use this, but I'm not sure why?
<<EOT
string data
EOT

https://discuss.hashicorp.com/t/line-continuation-within-a-variable/2220/4
atom88
<terraform>
How do I enter a multi line variable in Terraform?
doug
# How do I enter a multi line variable in Terraform?

(Asked by: username_0 on 2019-11-11)

It's for the public key variable for testing lab enviroments in my variables.tf file
I tried

`<`

but terraform dosn't seem to like that

**Tags:** terraform

> **Comments:**
> **username_1**: why do you need the EOF? Can't you just add the string with linebreaks in it?  
> **username_0**: I can for this example I was haveing issues with the key pair to do with the formating iv now resolved and thought in future it would be more efficent to use multi line to change the key more easily.  
> **username_1**: Ok. I' going to add the answer as appropriate  
> **username_2**: I have also seen examples where you have to do: <<-EOF LINE DATA EOF  note the "<<-EOF" instead of "<<EOF"  
> **username_2**: I have also seen examples that use this, but I'm not sure why? <<EOT string data EOT  https://discuss.hashicorp.com/t/line-continuation-within-a-variable/2220/4  

---

## 1 answers

### Answer by username_1 on 2019-11-11. Score: 2 | Accepted answer

[Terraform variable type constraints](https://www.terraform.io/docs/configuration/types.html) separate "primitive" types from "complex" types. These primitive types include strings:

> A primitive type is a simple type that isn't made from any other types. All primitive types in Terraform are represented by a type keyword. The available primitive types are:
>
> * string: a sequence of Unicode characters representing some text, such as "hello".
> * number: a numeric value. The number type can represent both whole numbers like 15 and fractional values such as 6.283185.
> * bool: either true or false. bool values can be used in conditional logic.

So, simply declaring the variable as a string, with the linebreaks in it would suffice.


---

