How do I enter a multi line variable in Terraform?

HOW TO -️ October 18, 2021

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

<<EOF the string EOF

but terraform dosn't seem to like that

Answer

why do you need the EOF? Can't you just add the string with linebreaks in it? 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. Ok. I' going to add the answer as appropriate I have also seen examples where you have to do: <<-EOF LINE DATA EOF

note the "<<-EOF" instead of "<<EOF" 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

Initializing...