Hi,
I am getting az cli not found in $path while configuring azurerm backend. My terraform code works if I remove backend config it only throws error once I configured backend. Below is the details of my terraform code and errors. Please help.
I am running from gitlab cicd.
this is my image of gitlab cicd
image:
name: hashicorp/terraform:1.3.7
entrypoint:
- ‘/usr/bin/env’
- ‘PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin’
terraform {
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “=3.39.0”
}
}
backend “azurerm” {
resource_group_name = “test”
storage_account_name = “rgtestdevstorageaccount”
container_name = “devtfstatefiles”
key = “test.tfstate”
}
}
Provider details
provider “azurerm” {
subscription_id = " "
client_id = " "
client_secret = " "
tenant_id = " "
features {}
}
$ terraform init -upgrade
28Initializing the backend…
29╷
30│ Error: Error building ARM Config: please ensure you have installed Azure CLI version 2.0.79 or newer. Error parsing json result from the Azure CLI: launching Azure CLI: exec: “az”: executable file not found in $PATH.
31│
works if I remove backend config
terraform init -upgrade
25Upgrading modules…
26- storage_account3 in …/…/dev/storage-account3
27Initializing the backend…
28Initializing provider plugins…
29- Finding hashicorp/azurerm versions matching “3.39.0”…
30- Installing hashicorp/azurerm v3.39.0…