jason-johnson / azure-pipelines-tasks-terraform

Azure Pipelines extension for Terraform
MIT License
122 stars 51 forks source link

Error: error loading state: unsupported checkable object kind "var" #384

Closed veldpworld closed 8 months ago

veldpworld commented 8 months ago

Terraform cli 0.78

2023-10-17T11:36:12.5683887Z ==============================================================================
2023-10-17T11:36:12.5684196Z Task         : Terraform CLI
2023-10-17T11:36:12.5684348Z Description  : Execute terraform cli commands
2023-10-17T11:36:12.5684569Z Version      : 0.7.8
2023-10-17T11:36:12.5684667Z Author       : Charles Zipp
2023-10-17T11:36:12.5684798Z Help         : 
2023-10-17T11:36:12.5684887Z ==============================================================================
2023-10-17T11:36:12.9304574Z [command]/home/linuxbrew/.linuxbrew/bin/terraform version
2023-10-17T11:36:12.9598945Z Terraform v1.5.2
2023-10-17T11:36:12.9599765Z on linux_amd64
2023-10-17T11:36:12.9601269Z + provider registry.terraform.io/hashicorp/azurerm v3.75.0
2023-10-17T11:36:12.9601708Z 
2023-10-17T11:36:12.9602294Z Your version of Terraform is out of date! The latest version
2023-10-17T11:36:12.9602986Z is 1.6.1. You can update by downloading from https://www.terraform.io/downloads.html
2023-10-17T11:36:12.9688728Z [command]/home/linuxbrew/.linuxbrew/bin/terraform plan -var-file /azp/_work/1/s/traffic_manager/vars/traffic-manager-xxx-xxx-uat.tfvars -out=/azp/_work/1/s/traffic_manager/traffic-manager-xxx-xxxuat.tfplan -detailed-exitcode
2023-10-17T11:36:14.3784394Z ╷
2023-10-17T11:36:14.3785373Z │ Error: error loading state: unsupported checkable object kind "var"
2023-10-17T11:36:14.3786102Z │ 
2023-10-17T11:36:14.3786329Z │ 
2023-10-17T11:36:14.3786579Z ╵
2023-10-17T11:36:14.3858504Z ##[error]Terraform command 'plan' failed with exit code '1'.
2023-10-17T11:36:14.3925524Z ##[error]╷
│ Error: error loading state: unsupported checkable object kind "var"
│ 
│ 
╵

2023-10-17T11:36:14.9281951Z ##[section]Finishing: Plan Apply

I can run this locally with terraform remote state but in azure pipeline it gives this error "Error: error loading state: unsupported checkable object kind "var""

I am not sure how to debug this error code. can you please guide me on this ? @charleszipp

veldpworld commented 8 months ago

can anyone faced this error ?

I can do terraform plan , apply locally. using this azure devops terraform cli I am getting the below error.

Error loading state: unsupported checkable object kind "var"   
Terraform command 'plan' failed with exit code '1'.
yuklia commented 8 months ago

should work with Terraform v1.6.1 🙂

jason-johnson commented 8 months ago

There isn't enough here to really troubleshoot. As yuklia alluded to, can you check the version you run locally? If they are the same, can you provide enough configuration to reproduce this error in a pipeline? I also see the pipeline task you are using is outdated.

veldpworld commented 8 months ago

i have deleted the tfstate file in azurebackend and again I rerun it worked. Not sure what was the issue. But in my local machine with 1.5.2 also it worked with same remote backend.

I close this thread.

DayoOyeyemi commented 5 months ago

Hi all I get this Error: Failed to load state: unsupported checkable object kind "var" when i run terragrunt-run-all apply, this is stack specific as it works fine with other stacks, am using (terraform version 1.3.7 & terragrunt version 0.53.1) please help

reynekec commented 4 months ago

Hi All. I now get this as well. I have many implementations and it is only 1 environment where this happens. Has anyone ever solved this?

DayoOyeyemi commented 4 months ago

Hi All. I now get this as well. I have many implementations and it is only 1 environment where this happens. Has anyone ever solved this?

This was resolved by updating to the latest terraform version across the development team, verify that everyone uses the same terraform version.