# Multi-line Variable problem

**URL:** <https://discuss.hashicorp.com/t/multi-line-variable-problem/10750>\
**Category:** HCP Terraform\
**Created:** [June 29, 2020, 7:40am UTC](https://discuss.hashicorp.com/t/multi-line-variable-problem/10750 "2020-06-29T07:40:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rramge](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/rramge/32/5921_2.png) [@rramge](https://discuss.hashicorp.com/u/rramge)\
**Post date:** [June 29, 2020, 7:40am UTC](https://discuss.hashicorp.com/t/multi-line-variable-problem/10750/1 "2020-06-29T07:40:18Z")

</div>

Hi,

I am confused 🙂 The documentation states “The text fields for variable values can handle multi-line text (typed or pasted) without any special effort.”

But I run into a error message “Value cannot contain newlines in environment variables” when trying to save a variable which contains an API key in PEM format

 ![TFC-Screenshot](https://global.discourse-cdn.com/hashicorp/original/2X/0/0779b96bd3faebf4999e17fb3c8eaa2e5ad16349.jpeg) .

IT was originally copy & pasted. Removing the line breaks manually and pressing enter again in the text field didn’t help.

Am I doing something wrong?  
Is there maybe a way to upload such files for referencing within the .tf which I didn’t see?

Thanks for help,

Ralf

---

<div class="post-metadata">

**Author:** ![twmcelroy](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/twmcelroy/32/1127_2.png) [@twmcelroy](https://discuss.hashicorp.com/u/twmcelroy)\
**Post date:** [June 29, 2020, 10:42pm UTC](https://discuss.hashicorp.com/t/multi-line-variable-problem/10750/2 "2020-06-29T22:42:23Z")

</div>

Tracking this as I’m guessing you are doing your variables for the OCI provider in Terraform Cloud? I never figured this out.

---

<div class="post-metadata">

**Author:** ![alisdair](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/alisdair/32/4227_2.png) [@alisdair](https://discuss.hashicorp.com/u/alisdair)\
**Post date:** [June 30, 2020, 1:56am UTC](https://discuss.hashicorp.com/t/multi-line-variable-problem/10750/3 "2020-06-30T01:56:34Z")

</div>

[Terraform Cloud has two types of variables](https://www.terraform.io/docs/cloud/workspaces/variables.html): Terraform input variables, and shell environment variables. Only Terraform input variables may contain newlines.

If you’re trying to use this value in your Terraform configuration, make sure to add it under the “Terraform Variables” section of your Terraform Cloud workspace.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![rramge](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/rramge/32/5921_2.png) [@rramge](https://discuss.hashicorp.com/u/rramge)\
**Post date:** [June 30, 2020, 8:04am UTC](https://discuss.hashicorp.com/t/multi-line-variable-problem/10750/4 "2020-06-30T08:04:32Z")

</div>

Yes, that makes sense. Thanks for tipping me off into the right direction 🙂

Ralf

---

<div class="post-metadata">

**Author:** ![drew.mullen](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/drew.mullen/32/44798_2.png) [@drew.mullen](https://discuss.hashicorp.com/u/drew.mullen)\
**Post date:** [February 12, 2025, 4:19pm UTC](https://discuss.hashicorp.com/t/multi-line-variable-problem/10750/5 "2025-02-12T16:19:34Z")

</div>

Sorry to resurrect but i ran into this problem too… wrote a little blog that outlines a few solutions for anyone also facing this: [Setting a multi-line variable as an ENV in Terraform Cloud - DEV Community](https://dev.to/drewmullen/setting-a-multi-line-variable-as-an-env-in-terraform-cloud-28b1)
