Storing Complex Variables»
OpenTofu/Terraform supports a variety of variable types such as string
, number
, list
, bool
, and map
. The full list of Terraform's variable types can be found in the documentation here.
When using "complex" variable types with Spacelift such as map
and list
you'll need to utilize OpenTofu/Terraform's jsonencode function when storing these variables as an environment variable in your Spacelift Stack environment or context.
Usage Example»
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
Notice the use of the jsonencode
function when storing these complex variable types. This will allow you to successfully store these variable types within Spacelift.
Consuming Stored Variables»
When consuming complex variable types in your environment, there is no need to use the jsondecode()
function.