“Terraform plan failure: Invalid value for input variable” error during Terraform deployment
search cancel

“Terraform plan failure: Invalid value for input variable” error during Terraform deployment

book

Article ID: 314916

calendar_today

Updated On:

Products

VMware Aria Suite VMware vSphere ESXi

Issue/Introduction

This article outlines a configuration issue which can cause Terraform deployment failures


Symptoms:

 

  • When leveraging the Terraform integration for vRealize Automation during the Terraform deployment the Terraform plan phase displays error:

“Terraform plan failure: Invalid value for input variable”.

  • In the deployment history you see:

Error: Invalid value for input variable

on /tmp/vra-tf-secrets/terraform.tfvars.json line 23:

23: "tags" : "{ Project = \"Test\"}",

The given value is not valid for variable "tags": map of string required.


Environment

VMware vRealize Automation 8.x
VMware vSphere ESXi 8.0.1

Cause

The issue is caused by serializing an object as a string and sending it to Terraform when Terraform is expecting a map of strings.

Resolution

The input variable in the yaml is a string. Example:

tags:

type: string

description: A map of tags to use for the instance.

Used in the yaml with to_string for example:

tags: ${to_string(input.tags)}

To resolve the issue remove the to_string

tags: {input.tags}

 

Terraform is expecting a map of strings. Once you remove the to_string a valid json object is then sent to terraform.


Attachments

terraformError get_app