-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Enhancement Request: azurerm
backend authentication upgrade to match provider
#34322
Comments
Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again! |
Is there likely to be a resolution for this? I've ended up here having spent a fair while trying to reasearch why my CI/CD pipelines fail to apply changes if I don't complete the manual validation within 10 minutes. After this time applying the plan file fails with the error "AADSTS700024: Client assertion is not within its valid time range". All this became an issue after I switched to the "recommended" use of Workload Identites. I arrived here via microsoft/azure-pipelines-terraform#201 and microsoft/azure-pipelines-terraform#89 It does not appear to be clear in the initial use case / description just how much of an issue this appears to be for many people. 33 people have upvoted this but I believe a lot more would if they found their way here. I have seen a few references to workarounds but with no clear examples of quite what to do. If anyone can advise a workaround then I would be grateful if they could post details. |
@Noel-Jones it is possible this could be addressed, but difficult to say how likely or when. Thanks for the additional use case! |
Related: #35381 (though closed) |
I think it is worth re-visiting this and adding some clarity as there are a few overlapping issues at play here:
Hopefully that helps in some way or I may have caused extra confusion... |
Hey folks, I am in the same situation as @Noel-Jones - in that I have a pipeline that does init, plan, then a manual approval step - then the apply stage is next - if the gap between init and apply is > 10 mins I get the following error:
I'm using Cheers |
Hey folks, it looks like we had a solution for this in #35381 that conflicted with a change @manicminer wanted to do on the azure backend. do we have any more news on this ? |
@jpomfret Did you have a go with AzureCli@2 task? I've got a similar issue and unpicking all the submodules to give it a go is a bit daunting if it doesn't help :D |
Hi @jpomfret . Did you resolve this? Are you supplying the id token to the init via CLI args? If so, don't do that. Supply it via an env var instead. If you supply it via cli args it gets cached in the plan file and will result in the timeout you are seeing. |
Hi @jaredfholgate - yes I am passing it in as a CLI arg. Thanks for your reply btw! and apologies @Nullh - I missed your message, but yes, still not working at this point - but partly due to other priorities |
@jaredfholgate Thank you for the further clarification for the intent of this issue at #34322, please allow me make a summary:
|
Hi. I am referring to supplying via the env vars in the provider. I'm not sure the Jason Johnson task currently supports that. I added it to the DevLabs task if you can use that instead? https://marketplace.visualstudio.com/items?itemName=ms-devlabs.custom-terraform-tasks It is the If you are just using Azure CLI, then you can set the env vars directly like this: https://github.com/Azure/accelerator-bootstrap-modules/blob/e848f90815c32eabc7c7a22a0fa2ad6da507695b/alz/azuredevops/pipelines/terraform/templates/helpers/terraform-init.yaml#L30 |
To confirm, they are hard-coded as CLI args in the JJ task, so would require an update I think: https://github.com/jason-johnson/azure-pipelines-tasks-terraform/blob/756f2ba62a644865933be62c2f5f94cdd36a9e75/tasks/terraform-cli/src/backends/azurerm.ts#L78 @jason-johnson FYI |
Terraform Version
Use Cases
I want to use
az
CLI service principal authentication in my CI / CD pipelines. I am able to do that with the upgraded authentication in the provider forplan
andapply
, butinit
does not support it for theazurerm
backend.I'd like to have a consistent authentication experience across all commands.
The original driver for this is running
terraform test
with OIDC auth. Since the Azure DevOps ID Token is only valid for 10 minutes and each test configures a new provider for each time it times out if there are a few tests in there.Attempted Solutions
There is no solution other than using the existing mechanism to supply service principal credentials.
Proposal
Update the
azurerm
backend authentication codeto match the provider code.
References
For clarity, this is the line in v0.43.0 of the target library that explicitly breaks SP auth with CLI: https://github.com/hashicorp/go-azure-helpers/blob/202cb910fbce8b8a78fe6e40177569b6ad59e885/authentication/auth_method_azure_cli_token.go#L72
The target library has significantly changed since that version and that code no longer exists in there.
No response
The text was updated successfully, but these errors were encountered: