How to use map input Variable in CDKTF

const variable new TerraformVariable(this, "variable"
      {
        type: `object({ nodeGroupName = string 
            instanceTypes = list
            minSize = number
            desiredSize = number
            maxSize = number
        })`,
});

How do I create a variable type map or object in CDKTF?
I also tried doing

const variable new TerraformVariable(this, "variable"
      {
        type: `object({ nodeGroupName :string, 
            instanceTypes: list,
        })`,
});

Hi @sabinaya.kc :wave:

There is the VariableType helper for that:

const variable = new TerraformVariable(this, "variable"
      {
        type: VariableType.object({
          nodeGroupName: VariableType.STRING,
          instanceTypes: VariableType.LIST_STRING,
          minSize: VariableType.NUMBER,
        }),
      }
);
1 Like