Pass JSON value in a .tfvars file

Hello Hi @apparentlymart,
I am passing a json value to a string variable as follows in the .tfvars file,
String variable= {“apis-demo”: “apis-demo”, “apis-demo.tls”: “apis-demo”}

I am getting the below issue:
Error: No value for required variable

and if I use jsonencode func - Error: Function calls not allowed

Could you please help me to solve this issue. Please tell me how to pass a json value to .tfvars file.

Hi @abinayasivaprakasam,

I’d be happy to try to help here. In order that I can see all of what you are seeing, could you please share the following?:

  • All of the variable declarations in your root module.
  • The full command line you used to run Terraform.
  • All of the .tfvars files that were included in that run, including any automatic terraform.tfvars or .auto.tfvars files that would be included.
  • The full text of the error message you saw, without editing anything out.

I’m asking for these because the error message you’ve described here doesn’t seem related to JSON and so I think there must be something else happening, but I can’t tell what that would be without seeing more information. Thanks!





I have attached the images of my files. Kindly help me to resolve the issue. Thanks in advance!

Hello Hi @apparentlymart,
Hope you’re doing well !
Did you get a chance to look at my issue ?
Thank you !