我定义了用Swift管理tfstate的远程后端。
terraform {
backend "swift" {
container = "example"
}
}运行"terraform init“后,有时会出现以下错误:
Do you want to copy existing state to the new backend?
Pre-existing state was found while migrating the previous "swift" backend to the
newly configured "swift" backend. An existing non-empty state already exists in
the new backend. The two states have been saved to temporary files that will be
removed after responding to this query.
Previous (type "swift"): /tmp/terraform704677678/1-swift.tfstate
New (type "swift"): /tmp/terraform704677678/2-swift.tfstate
Do you want to overwrite the state in the new backend with the previous state?
Enter "yes" to copy and "no" to start with the existing state in the newly
configured "swift" backend.
Enter a value:这使运行Terraform的自动化变得非常困难,因为需要意外的输入。
我需要Ansible只使用保存在容器中的远程tfstate操作,而不需要本地文件。
完成terraform init任务后,没有/tmp/terraform*。
提前谢谢你的帮助。
发布于 2019-10-11 13:14:48
在下一个版本的OpenStack提供程序中修复了问题。
发布于 2019-05-14 13:24:48
看来你在处理两个州文件。如果您确信它现在正在尝试使用正确的状态,您可以说是并让它将旧状态复制到新状态,那么这个错误将不会再次出现。
https://serverfault.com/questions/967043
复制相似问题