-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key Vault Key Not Found for the multi-subscription case #3959
Comments
We have discovered the same problem now.. It is also mentioned in #2396 when changing from using uri to id. It is recommended to use a different provider for data source, but that is not a good solution as it requires that it has access to that subscription. The Key Vault is in a subscription the CI service principal should not have access to. It has read access to a specific Key Vault in that subscription, but no access to subscription or any resource groups in that subscription. As it is now it doesn't work in a secure CI pipeline. At least data source could use the vault_uri and not id attribute. I can see the problems it creates for key_vault resources when uri doesn't resolve to any valid dns if it is deleted and exists in state. For data source however it has to exist to even work, so why can't it just keep using vault_uri and therefore not depend on access in another subscription? |
👋 Taking a look through here this behaviour is expected since at this time we're looking the Key Vault up using the Key Vault ID, within the Subscription, as such you'd need to use a Provider alias to look this up, for example:
It's worth noting that this behaviour is now called out in the documentation:
Since this behaviour is expected at this time and called out in the documentation - I'm going to close this issue for the moment - however should you have any further usage questions I'd point you to the community forums where someone should be able to help. Thanks! |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_key_vault_key
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Retrieve Key from KeyVault from subscription different from current context.
Actual Behavior
Resource
azurerm_key_vault_key
is trying to verify if KeyVault exists in the current subscription when KeyVault and its resource group are placed in the another one, so it raises Resource Group Not Found error.Steps to Reproduce
azurerm_key_vault_key
from Key Vault in Subscription 2 (xxxx-xxxx-xxxx-xxxx)terraform apply
Important Factoids
References
This issue should appear after merge of PR #2820 (comment)
The text was updated successfully, but these errors were encountered: