terraform-provider-azurerm: v3.0.1: azurerm_key_vault: Cannot read the ressource with KeyVault: keyvault.BaseClient#GetCertificateContacts
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave “+1” or “me too” comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Terraform (and AzureRM Provider) Version
Terraform v1.1.7 azurerm v3.0.1
Affected Resource(s)
azurerm_key_vault
Expected Behaviour
No error
Actual Behaviour
Cannot read the ressource with `KeyVault: keyvault.BaseClient#GetCertificateContacts: Failure sending request: StatusCode=0 – Original Error: context deadline exceeded
Steps to Reproduce
- Create a keyvault with v2:
resource "azurerm_key_vault" "mykeyvault" {
name = "mykeyvault"
sku_name = "standard"
location = "myloc"
resource_group_name = "myrg"
tenant_id = "mytenant"
purge_protection_enabled = true
}
- with v3, do a terraform plan
Important Factoids
Since v3, azurerm is trying to fetch “contact” from KeyVault and for some reason, the access is timing out. I’ve tried adding ManagedContacts permission but no luck.
Using same credentials, I can access the API without isuse.
az rest --method GET --uri "https://mykeyvault.vault.azure.net/certificates/contacts?api-version=7.1" --resource "https://vault.azure.net"
Not Found({"error":{"code":"ContactsNotFound","message":"Contacts not found"}})
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 37
- Comments: 32 (15 by maintainers)
I have a similar issue. Simply referencing a certificate in a key vault causes the plan to fail
The plan command fails (after a long while) with the following error:
I have these both issues as well. Had to roll back to provider 2.99.0
@manicminer glad you found the key, I promptly broke my terraform config after hitting this bug (developing something else, this was non-blocking for the moment) and also (like an idiot) deleted the debug log so couldn’t reproduce quickly enough.
I am using Azure CLI authentication.
@manicminer i do and i’m pretty sure i’m not the only one. I’m using “plain” Azure Subscription not a USGovernment
I believe this issue may be related to
use_msal = true(which is now on by default in azurerm >= 3.0).Works: v2.99 with
use_msal= falseOutput:
Fails: v2.99 with
use_msal = trueOutput:
FWIW, I’m not getting a failure to create this key_vault with azurerm 3.1.0. However, I wanted to paste my findings above since it seemed to be the exact same error message from the OP, and in case it provides a clue to where the problem may be.
@eoly Thanks for the log, that’s super helpful 👍
Anyone else, please kindly refrain from posting +1 comments and instead upvote the issue. Debug logs are always happily received!
@manicminer
Here are my TF_DEBUG logs. I have the
context deadline exceededissue too.Using Azure CLI auth.
https://gist.github.com/eoly/702d9e6da370cd946372bce3677db830
Sorry no logs since I reverted back.
I’m also using Azure CLI authentication
I just ran into a similar issue with azurerm_key_vault_secret data source
I see this for both v3.0.0 and v3.0.1