# Terraform Plan getting error

**URL:** <https://discuss.hashicorp.com/t/terraform-plan-getting-error/55808>\
**Category:** Terraform\
**Created:** [July 7, 2023, 9:26am UTC](https://discuss.hashicorp.com/t/terraform-plan-getting-error/55808 "2023-07-07T09:26:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rachanasinghr4](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@rachanasinghr4](https://discuss.hashicorp.com/u/rachanasinghr4)\
**Post date:** [July 7, 2023, 9:26am UTC](https://discuss.hashicorp.com/t/terraform-plan-getting-error/55808/1 "2023-07-07T09:26:46Z")

</div>

Hi

While doing terraform Plan I am getting this error, kindly help to provide reason

var.iexams\_allowedremote  
Trusted sources to allow RDP/ SSH access from. e.g. {iexams\_mgmt=[“gen”]} e.g. 1.2.3.4/32, 5.6.7.8/24

Enter a value: fakse

var.iexams\_elb  
Map of elb instances in iexams networks

Enter a value: false

var.iexams\_tgw  
Map of vpc transit gateways used for indirect reference by iexams\_networks.

Enter a value: false

var.iexams\_vpcpeers  
Map of vpc peerings used for indirect reference by iexams\_networks.

Enter a value: false

Error: Variables not allowed

on line 1:  
(source code not available)

Variables may not be used here.

Error: No value for required variable

on variables.tf line 147:  
147: variable “iexams\_allowedremote” {

The root module input variable “iexams\_allowedremote” is not set, and has no  
default value. Use a -var or -var-file command line argument to provide a  
value for this variable.

Attached tfvars

iexams\_allowedremote = {  
sshtsn = {}# {mgmt=[“gen”]}  
rdptsn = {} # {mgmt=[“gen”]}  
sshtip = [“172.16.159.51/32”,“172.16.159.54/32”,“172.16.159.45/32”,“172.16.159.56/32”,“172.16.159.39/32”,“172.16.159.43/32”,“172.16.159.49/32”,“172.16.159.55/32”,“172.16.159.40/32”,“172.16.159.44/32”,“172.16.159.48/32”,“172.16.159.47/32”]  
rdptip = [“10.194.191.128/25”,“172.16.159.51/32”,“172.16.159.54/32”,“172.16.159.45/32”,“172.16.159.56/32”,“172.16.159.39/32”,“172.16.159.43/32”,“172.16.159.49/32”,“172.16.159.55/32”,“172.16.159.40/32”,“172.16.159.44/32”,“172.16.159.48/32”,“172.16.159.47/32”]  
va\_enable = true  
va\_tip =   
va\_tsg = [“sg-034be26faf8723e30”]  
comm\_enable = true  
comm\_tip =   
comm\_tsg = [  
{srcsg=“sg-0157733e3560b510c”, destportstart=4118, destportend=4118, destproto=“tcp”, description=“Allow communications from DSM manager to client.”},  
{srcsg=“sg-0157733e3560b510c”, destportstart=4122, destportend=4122, destproto=“tcp”, description=“Allow communications from DSM manager to client.”}  
]  
}

iexams\_elb = {  
ezweblb = { name=“weblb”, vpc=“eapp”, subnet=[“web”], internal=false, elb\_type=“application”, sg = ,  
cross\_zone=true, enable\_deletion\_protection=true,  
purpose = “ELB for internet web tier”,  
default\_acm\_cert=“”,  
default\_acm\_certkey=“”,  
default\_acm\_certchain=“”,  
lsnr = [  
{ port=80, protocol=“TCP”, ssl\_policy=“”,  
country=“”, province=“”, locality=“”,  
org=“”, ou=“”, fqdn=“”, valid\_hours=0 },  
{ port=443, protocol=“TLS”, ssl\_policy=“ELBSecurityPolicy-2016-08”,  
country=“SG”, province=“Singapore”, locality=“Singapore”,  
org=“SEAB”, ou=“ITB”, fqdn=“uat.iex.seab.gov.sg”, valid\_hours=87600 },  
],  
tg = [  
{ name=“tcp”, port=80, protocol=“TCP”, proxy\_protocol\_v2=false,  
target\_type=“instance”,  
purpose=“Target group for web lb”,  
sk = { type=“”, cookie\_duration=0, enabled=false}  
hc = { interval=30, timeout=10, port=80, protocol=“TCP”, path=“/”,  
healthy\_threshold=3, unhealthy\_threshold=3, matcher=“200-299”  
},  
att = { port=80 }  
}  
]  
},

---

<div class="post-metadata">

**Author:** ![apparentlymart](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/apparentlymart/32/702_2.png) [@apparentlymart](https://discuss.hashicorp.com/u/apparentlymart)\
**Post date:** [July 7, 2023, 3:29pm UTC](https://discuss.hashicorp.com/t/terraform-plan-getting-error/55808/2 "2023-07-07T15:29:01Z")

</div>

Hi @rachanasinghr4,

From what you shared it seems like you entered “fakse” at the prompt for `var.iexams_allowedremote`.

That variable seems to expect an object value (based on the example in the description) and so Terraform was expecting you to enter a constant-only expression whose result is an object of the expected type.

“fakse” is understood by Terraform as a reference to another object named `fakse`, and it is invalid to refer to other objects here because input variable values must be constants.

I suspect you intended to type `false`, which Terraform would have accepted as valid syntax but would still not be a value of the correct type: `false` is a boolean value, not an object.

The ability to enter variable values at a prompt when you run Terraform is primarily to help with learning Terraform from tutorials, so that the tutorials can show a successful use of `terraform apply` without explaining how to set input variables first. When you graduate from that learning phase I would suggest always setting all of your variables in `.tfvars` and no longer relying on the interactive prompts, because then you can more easily ensure that the values stay consistent from one run to the next (e.g. by placing the `.tfvars` files under version control.)

---

<div class="post-metadata">

**Author:** ![rachanasinghr4](https://avatars.discourse-cdn.com/v4/letter/r/db5fbb/32.png) [@rachanasinghr4](https://discuss.hashicorp.com/u/rachanasinghr4)\
**Post date:** [July 7, 2023, 3:59pm UTC](https://discuss.hashicorp.com/t/terraform-plan-getting-error/55808/3 "2023-07-07T15:59:29Z")

</div>

Hi

Thanks for replyng, I tried to fix few items fixed but unable to fix below,

var.iexams\_vpcpeers  
Map of vpc peerings used for indirect reference by iexams\_networks.

Enter a value:

Error: Invalid expression

on line 1:  
(source code not available)

Expected the start of an expression, but found an invalid expression token.

Error: No value for required variable

on variables.tf line 121:  
121: variable “iexams\_vpcpeers” {

The root module input variable “iexams\_vpcpeers” is not set, and has no  
default value. Use a -var or -var-file command line argument to provide a  
value for this variable.

Below is my .tfvar

iexams\_vpcpeers = {

# mgmt\_idmz = “pcx-030541d86633eb85a”

eapp\_iegress = “pcx-088b39c21a265f858”  
iegressnp\_eapp = “pcx-0a40e06e33abc5499”  
iegressnp\_mgmt = “pcx-08872d1da3dfdff87”  
eapp\_aapp = “pcx-04c0d31d6c020f030”  
aapp\_mgmt = “pcx-00c78866a58c47b52”  
mgmt\_eapp = “pcx-01a2855519c73a6ac”  
mgmt\_mgmt2 = “pcx-0344a8b2ceb04e258”

# mgmt\_bastion = “pcx-0b2cf3985e9734f60”

# bastion\_idmz = “pcx-06aedb3a022827e8c”

# bastion\_aapp = “pcx-04c57ce99d29f6ec2”

# bastion\_eapp = “pcx-08bd50934c787ef37”

iexams\_uat\_mims = “pcx-09a55804da32c757c”  
}

Var.tf

variable “iexams\_vpcpeers” {  
type = map(any)  
description = “Map of vpc peerings used for indirect reference by iexams\_networks.”  
}

Can help what could be the issue
