0

I have declared the below variables in my main.tf file:

variable "TF_VAR_ARM_CLIENT_ID" {}

variable "TF_VAR_ARM_CLIENT_SECRET" {}

variable "TF_VAR_ARM_SUBSCRIPTION_ID" {}

variable "TF_VAR_ARM_TENANT_ID" {}

I have created these variables in Azure Release Pipelines and defined it to be accessible to all pipelines as below:

enter image description here

I am unable to understand why Release Job reports why these variables are not set:

2019-03-06T00:24:27.8892810Z Error: Required variable not set: TF_VAR_ARM_SUBSCRIPTION_ID
2019-03-06T00:24:27.8899867Z 
2019-03-06T00:24:27.8899984Z 
2019-03-06T00:24:27.8900027Z 
2019-03-06T00:24:27.8900136Z Error: Required variable not set: TF_VAR_ARM_TENANT_ID
2019-03-06T00:24:27.8900190Z 
2019-03-06T00:24:27.8900227Z 
2019-03-06T00:24:27.8900403Z 
2019-03-06T00:24:27.8900489Z Error: Required variable not set: TF_VAR_ARM_CLIENT_SECRET
2019-03-06T00:24:27.8900540Z 
2019-03-06T00:24:27.8900592Z 
2019-03-06T00:24:27.8900627Z 
2019-03-06T00:24:27.8900692Z Error: Required variable not set: TF_VAR_ARM_CLIENT_ID

I tried to add a command line out as like below just before terraform plan,

echo $TF_VAR_ARM_SUBSCRIPTION_ID

echo $TF_VAR_ARM_TENANT_ID

echo $TF_VAR_ARM_CLIENT_SECRET

echo $TF_VAR_ARM_CLIENT_ID

Unfortunately, I do not see the values in execution,

2019-03-06T00:52:11.4389621Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a\_temp\ed34e1a6-ccc4-4168-a15b-3bd5e273d9e7.cmd""
2019-03-06T00:52:11.4490377Z $TF_VAR_ARM_SUBSCRIPTION_ID
2019-03-06T00:52:11.4491943Z $TF_VAR_ARM_TENANT_ID
2019-03-06T00:52:11.4493642Z $TF_VAR_ARM_CLIENT_SECRET
2019-03-06T00:52:11.4495118Z $TF_VAR_ARM_CLIENT_ID

I tried both ways, first make as secret and then define the value and also first define value and then make it secret but error still persist.

Any idea what could be the issue?

learner
  • 2,480
  • 10
  • 50
  • 94

1 Answers1

1

You need to link variable group to the release, using the release variable section.

enter image description here

right now your variable group simply exists, but is not being used.

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • There were linked already mate, the problem got solved when I removed initial TF_VAR_ from terraform.tfvars file. Now it works, but I want to make them as hidden. When I hide them as secret with Lock key, in pipeline it reports variables are not set... – learner Mar 06 '19 at 12:01
  • probably worth opening up a new question – 4c74356b41 Mar 06 '19 at 12:03