Skip to content
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

Confusing error message on expired credentials #1878

Open
VenelinMartinov opened this issue Mar 15, 2024 · 0 comments
Open

Confusing error message on expired credentials #1878

VenelinMartinov opened this issue Mar 15, 2024 · 0 comments
Labels
area/docs Improvements or additions to documentation kind/bug Some behavior is incorrect or out of spec

Comments

@VenelinMartinov
Copy link
Contributor

VenelinMartinov commented Mar 15, 2024

What happened?

The Azure provider prints a long and confusing TF related error message when the local credentials have expired.

We can probably do something similar to pulumi/pulumi-aws#2285 and match the error and print a better message.

The issue is fixed with az login but we print ~20 lines of unrelated text in the error before pointing the user to az login

Example

    error: 1 error occurred:
        * Error ensuring Resource Providers are registered.
    
    Terraform automatically attempts to register the Resource Providers it supports to
    ensure it's able to provision resources.
    
    If you don't have permission to register Resource Providers you may wish to use the
    "skipProviderRegistration" flag in the Provider block to disable this functionality.
    
    Please note that if you opt out of Resource Provider Registration and Terraform tries
    to provision a resource from a Resource Provider which is unregistered, then the errors
    may appear misleading - for example:
    
    > API version 2019-XX-XX was not found for Microsoft.Foo
    
    Could indicate either that the Resource Provider "Microsoft.Foo" requires registration,
    but this could also indicate that this Azure Region doesn't support this API version.
    
    More information on the "skipProviderRegistration" flag can be found here:
    https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#skip_provider_registration
    
    Original Error: populating Resource Provider cache: listing Resource Providers: loading results: authorizing request: running Azure CLI: exit status 1: ERROR: AADSTS700082: The refresh token has expired due to inactivity. The token was issued on 2024-03-14T13:26:50.7085348Z and was inactive for 12:00:00. Trace ID: 9e6e1da6-1da3-47cd-a1bb-6bb97fad1e00 Correlation ID: ecad4313-2dea-40cd-af14-f8c19930a077 Timestamp: 2024-03-15 12:52:28Z
    Interactive authentication is needed. Please run:
    az login --scope https://management.azure.com/.default

Output of pulumi about

CLI          
Version      3.108.1
Go Version   go1.22.0
Go Compiler  gc

Plugins
NAME    VERSION
azure   4.42.0
nodejs  unknown

Host     
OS       darwin
Version  14.1.1
Arch     arm64

This project is written in nodejs: executable='/opt/homebrew/bin/node' version='v21.6.1'

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/venelin-pulumi-corp
User           venelin-pulumi-corp
Organizations  venelin-pulumi-corp, demo, pulumi
Token type     personal

Dependencies:
NAME            VERSION
@pulumi/azure   4.42.0
@pulumi/pulumi  3.108.1
@types/node     10.17.60
mime-types      2.1.35

Pulumi locates its logs in /var/folders/82/nqnqw81s1h56l5nv940f9mq00000gn/T/ by default
warning: Failed to get information about the current stack: No current stack

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@VenelinMartinov VenelinMartinov added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Mar 15, 2024
@guineveresaenger guineveresaenger added area/docs Improvements or additions to documentation and removed needs-triage Needs attention from the triage team labels Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs Improvements or additions to documentation kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants