Terraform ResourceNotFound Error While running Azure Pipeline

sai pavan 20 Reputation points
2024-03-20T15:47:26.4466667+00:00

Hi Team,

I'm facing issue with Terraform init from azure pipeline

"Failed to get existing workspaces: containers.Client#ListBlobs: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="ResourceNotFound" Message="The specified resource does not exist.\nRequestId"

Can any one please help me out to reslove the issue.

terraform

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
2,944 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Amrinder Singh 4,670 Reputation points Microsoft Employee
    2024-03-20T16:23:40.4666667+00:00

    Hi @Sai pavan - Thanks for reaching out on Q&A forum.

    Based on the exception, it points that it is trying to perform the list blob operation however failing to find the resource. Some of the possible reasons could be:

    Incorrect URL formation resulting into path not being located.

    Anonymous access but container level not set correctly.

    Can you please share the complete exception snippet along with the failed request ID if possible?


  2. Anand Prakash Yadav 7,780 Reputation points Microsoft Vendor
    2024-03-21T08:57:26.3533333+00:00

    Hello sai pavan,

    Thank you for posting your query here!

    Can you please try to navigate to the storage account, then to the container in the Azure portal that holds the state file. The blob will show as ‘Leased’ under the leased state column. Select the state file and hit the ‘break lease’ button.
    User's image

    The lease state on the state file blob should then show as ‘broken’, and you can kick off the next Terraform run.

    Or using Terraform you can force the unlock, (get the LockID from the error) e.g.

    terraform force-unlock <LockId>

    Similar posts that might help: https://stackoverflow.com/questions/65595852/terraform-statefile-is-locked-how-do-i-unlock-it

    https://stackoverflow.com/questions/64690427/error-locking-state-error-acquiring-the-state-lock-state-blob-is-already-locke

    Do let us know if you have any further queries. I’m happy to assist you further.

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments