Terraform vars into VSTS vars
To contribute to this extension, please visit this repository.
A lot of people use Terraform for infrastructure as code, and they save their values in tfvar files, for every environment. In addition, when running builds and releases, sometimes you may need those values to pass them to other build tasks. This task is handy in such situation, where you would like to extract a tfvar value so easily into an Azure Devops variable $(something). It also supports the lookup option where there is a root key. The below examples should explain more.
How to use the task
These are the supported two scenarios on how to use the task.
When you have a direct key and value declared in a tfvar file like the below example:
In this case, your properties in your task should look like that: (notice that the root key is left blank)
When you have a root key, a key and value declared in a tfvar file like the below example. This is known as a lookup variable:
In this case, your properties in your task should look like that: