Azure / caf-terraform-landingzones-accelerator

Starter project for Applications (level 4) Cloud Adoption Framework for Azure landing zones on Terraform
MIT License
205 stars 233 forks source link

Level2 - Error Loading State #92

Open kgibson-insight opened 3 years ago

kgibson-insight commented 3 years ago

Describe the bug

│ Error: Error loading state error
│ 
│   with data.terraform_remote_state.remote["foundations"],
│   on locals.remote_tfstates.tf line 19, in data "terraform_remote_state" "remote":
│   19:   backend = var.landingzone.backend_type
│ 
│ error loading the remote state: failed to lock azure state: 2 errors
│ occurred:
│       * blobs.Client#AcquireLease: Failure sending request: StatusCode=409 --
│ Original Error: Error occurred unmarshalling JSON - Error = 'invalid
│ character '<' looking for beginning of value' JSON = '<?xml version="1.0"
│ encoding="utf-8"?><Error><Code>LeaseAlreadyPresent</Code><Message>There is
│ already a lease present.
│ RequestId:37995ab0-501e-00e9-4eeb-87af64000000
│ Time:2021-08-02T22:10:36.1165552Z</Message></Error>'
│       * blob metadata "terraformlockid" was empty

To Reproduce Sync repo and deploy level2 as instructed with rover:

rover -lz /tf/caf/walkthrough/landingzones/caf_solution \
-var-folder /tf/caf/walkthrough/configuration/sandpit/level2/networking/hub \
-tfstate hub.tfstate \
-level level2 \
-env sandpit \
-a apply
shuft commented 3 years ago

A bit late now to suggest this perhaps, but the error code LeaseAlreadyPresent suggests that a previous rover run has crashed and left the storage blob locked. You can manually break the lease in the Azure Portal, and try again.