ObjectID is null

Kaushalendra Kumar 106 Reputation points
2022-12-01T15:29:00.987+00:00

I have been struggling with the below error for quite some time. I haven't been able to find any solution on how to fix this. There are only discussion available on this topic why this being caused but no solution on how to fix this. May be someone here can help me with the solution on this platform. This below error comes when I try to deploy/fetch data from terraform of Azure Key vault.

╷  
│ Error: expected "access_policy.0.object_id" to be a valid UUID, got  
│  
│   with module.main_kv_001.azurerm_key_vault.vault,  
│   on ../../XXXXX/shared/keyvault/main.tf line 28, in resource "azurerm_key_vault" "vault":  
│   28:     object_id = data.azurerm_client_config.current.object_id  
│  
╵  
Releasing state lock. This may take a few moments...  
kaus3778@AAD-4MLD9K3:/mnt/c/projects/XXXXX/scaffold$  

Here is my configuration-

kaus3778@AAD-4MLD9K3:/mnt/c/projects/XXXXXX/scaffold$  az account show --query "{subscriptionId:id, tenantId:tenantId,objectId:objectId}"  
{  
  "objectId": null,  
  "subscriptionId": "XXXXXXXXXX",  
  "tenantId": "XXXXXXXXXX"  
}  
kaus3778@AAD-4MLD9K3:/mnt/c/projects/XXXXXX/scaffold$  
  
  
  
  
  
kaus3778@AAD-4MLD9K3:/mnt/c/projects/XXXXXX/scaffold$ az version  
{  
  "azure-cli": "2.42.0",  
  "azure-cli-core": "2.42.0",  
  "azure-cli-telemetry": "1.0.8",  
  "extensions": {  
    "account": "0.2.3"  
  }  
}  
kaus3778@AAD-4MLD9K3:/mnt/c/projects/XXXXXX/scaffold$  
  
  
  
kaus3778@AAD-4MLD9K3:/mnt/c/projects/XXXXXX/scaffold$ terraform -v  
Terraform v1.3.5  
on linux_amd64  
+ provider registry.terraform.io/hashicorp/azurerm v3.4.0  
+ provider registry.terraform.io/hashicorp/local v2.2.3  
kaus3778@AAD-4MLD9K3:/mnt/c/projects/XXXXXX/scaffold$  
Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
1,286 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Hari Dinesh Krishnamurthy 0 Reputation points
    2023-10-16T18:21:24.3333333+00:00

    I was struggling with this for the past 2 days and found that terraform version was outdated on my system. All I did was upgraded to the latest version (terrform init -upgrade) - guess what, it just worked man!

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.