Open serbezki opened 3 weeks ago
An extra note that can be of help - I tried adding a 1 minute delay after the endpoint creation and before the secrets creation. That didn't work, regardless of how long the delay is.
Most likely terraform keeps the connection open and doesn't realize the vault has a different IP now. I'm wondering how that connection can be re-initialized. I thought a about using a data block and referencing that for the secrets, but that messes up the plan since before any of this is created the data block points to a non-existent resource.
The error message indicates your machine running Terraform is not from a subnet that has the access to the private endpoint. Meanwhile, since you have no network rule to allowlist the IP of your machine, it is blocked and you got a 403. So please either update the network rule, or ensure your machine is from the vnet that peers to/is the vnet of the private endpoint.
If that were the problem then why would it work fine on the next run?
The configuration is okay, it only fails to work through it in one go. That's why I believe it should be a provider fix, anything that works fine after you re-run should be handled in the provider imo.
Presumably you have a azurerm_key_vault_access_policy
defined, and you haven't defined a dependency on it in your azurerm_key_vault_secret
?
Is there an existing issue for this?
Community Note
Terraform Version
1.9.7
AzureRM Provider Version
4.7.0
Affected Resource(s)/Data Source(s)
azurerm_key_vault
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
Vault, private endpoint and then secrets all get created without any problems.
Actual Behaviour
Secret creation fails because vault is inaccessible. It works fine when you re-run.
Steps to Reproduce
Create vault with public access disabled, private endpoint and secret in the same config.
Important Factoids
No response
References
No response