Open F21 opened 12 months ago
Also getting this issue but with different versions. Running a TF version of 1.5.7 and a provider version of 3.21 it works fine. However when I switch the provider version to 3.22 it returns the creds intermittently and they fail.
Edit: Actually maybe my issue is slightly different but related.
I had the following set:
data "vault_azure_access_credentials" "aad" {
backend = var.vault_backend
role = var.vault_role
validate_creds = true
num_sequential_successes = 10
num_seconds_between_tests = 10
}
Prior to provider version 3.22 it would allow time for consistency as follows:
But in version 3.22 it just returns them immediately without any pause so they fail as not enough time has passed. So validation is not working as it should.
Unfortunately, this is a known issue with Azure since it is eventually consistent. We are looking into ways of solving this but for now we have no way of ensuring the credentials are propagated across all Azure data centers.
We have observed that service principal credentials propagate throughout the Azure data centers faster than application credentials, which leads to less delays and consistency issues. If possible a workaround would be to always use dynamic service principles i.e. don't provide application_object_id but instead use azure_roles when creating the Role in Vault.
We're currently using pre-created service principals, because dynamic service principals don't work with API calls for Azure AD (only Azure RM).
References:
Terraform Core Version
1.6.3
Terraform Vault Provider Version
3.21.0
Vault Server Version
1.15.0
Affected Resource(s)
Expected Behavior
The credentials returned by
vault_azure_access_credentials
should be guranteed to be working ifvalidate_creds
is set to `true.Actual Behavior
The credentials fail intermittently and we often need to retry the plan or apply to get it to work. It fails interminenttly when used with the azuread and azurerm providers.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None