Terraform Plan getting error

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 }
}
]
},

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.)

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