[x] Upgrade Terraspace: Are you using the latest version of Terraspace? This allows Terraspace to fix issues fast. There's an Upgrading Guide: https://terraspace.cloud/docs/misc/upgrading/
[x] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
[ ] Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.
My Environment
Software
Version
Operating System
Ubuntu 20.04
Terraform
v1.3.1
Terraspace
v2.2.2
Ruby
v3.1.2
Expected Behaviour
When terraspace all down --yes --exit-on-fail runs, it calls terraform init -get -input=false for each stack and only once.
Current Behavior
When terraspace all down --yes --exit-on-fail runs, it calls terraform init -get -input=false for each stack.
Currently the theory is the terraform init gets called or runs twice in parallel for the same stack, this is because of duplicate initializations found in the init logs for stacks.
This results in a failure: "Error locking state: Error acquiring the state lock Error message: resource temporary unavailable".
This seems to be resolvable by running terraspace all init --yes --exit-on-fail before the destroy.
Step-by-step reproduction instructions
Run terraspace all down --yes --exit-on-fail on a project in a clean environment/workspace without any terraspace all init.
Code Sample
Sadly can't provide a code sample from the project.
Solution Suggestion
I attempted to look into the function that calls the terraform init but I can't see how it would ever run twice in parallel resulting in this issues.
Checklist
My Environment
Expected Behaviour
When
terraspace all down --yes --exit-on-fail
runs, it callsterraform init -get -input=false
for each stack and only once.Current Behavior
When
terraspace all down --yes --exit-on-fail
runs, it callsterraform init -get -input=false
for each stack.Currently the theory is the
terraform init
gets called or runs twice in parallel for the same stack, this is because of duplicate initializations found in the init logs for stacks.This results in a failure: "Error locking state: Error acquiring the state lock Error message: resource temporary unavailable".
This seems to be resolvable by running
terraspace all init --yes --exit-on-fail
before the destroy.Step-by-step reproduction instructions
Run
terraspace all down --yes --exit-on-fail
on a project in a clean environment/workspace without anyterraspace all init
.Code Sample
Sadly can't provide a code sample from the project.
Solution Suggestion
I attempted to look into the function that calls the
terraform init
but I can't see how it would ever run twice in parallel resulting in this issues.