-
Notifications
You must be signed in to change notification settings - Fork 26
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
Error acquiring the state lock when executing task when backend set as consul #546
Comments
Hi @sameer666, thanks for reporting this issue! I've got a few questions to help us debug and reproduce this problem.
|
|
Thanks for the clarifications! Nothing is standing out to me as the root cause of your issue, and I haven't been able to reproduce it. Here are some debugging steps you could try next:
|
Describe the bug
When not setting the backend manually in driver "terraform" block, it sets it as consul.
When trying to execute the task, Terraform is trying to acquire the state lock but it is failing with the following error:
2021-12-16T16:01:29.834+0530 [INFO] ctrl: driver initialized
2021-12-16T16:01:29.834+0530 [INFO] ctrl: executing all tasks once through
2021-12-16T16:01:29.835+0530 [DEBUG] ctrl: watching dependencies: dependency_size=2
2021-12-16T16:01:30.057+0530 [DEBUG] driver.terraform: change detected for task: task_name=web
2021-12-16T16:01:30.081+0530 [INFO] ctrl: executing task: task_name=web
2021-12-16T16:01:35.681+0530 [ERROR] cli: error running controller in Once mode:
error=
| could not apply changes for task web: error tf-apply for 'web': exit status 1
|
| Error: Error loading state: failed to lock state in Consul:
|
On setting the backend as local, the execution works as expected.
When trying to run the module directly instead of through consul terraform sync, it works with the backend set as consul.
Versions
Consul Terraform Sync
Consul Version
Terraform Version
Configuration File(s)
using CTS to monitor 2 services in consul and call a module to create dynamic object mapping on Cisco FMC
Terraform Configuration Files Generated by Consul-Terraform-Sync
Click to toggle contents of main.tf
Click to toggle contents of terraform.tfvars
Expected Behavior
Task gets executed and dynamic objects are updated with the new mappings of IP Addresses
Actual Behavior
Task is not getting executed with the error
Error acquiring the state lock when executing task
The text was updated successfully, but these errors were encountered: