首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Terraform在使用远程后端时创建本地tfstate

Terraform在使用远程后端时创建本地tfstate
EN

Server Fault用户
提问于 2019-05-13 13:50:04
回答 2查看 314关注 0票数 0

我定义了用Swift管理tfstate的远程后端。

代码语言:javascript
复制
terraform {
  backend "swift" {
    container = "example"
  }
}

运行"terraform init“后,有时会出现以下错误:

代码语言:javascript
复制
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*。

提前谢谢你的帮助。

EN

回答 2

Server Fault用户

回答已采纳

发布于 2019-10-11 13:14:48

在下一个版本的OpenStack提供程序中修复了问题。

票数 0
EN

Server Fault用户

发布于 2019-05-14 13:24:48

看来你在处理两个州文件。如果您确信它现在正在尝试使用正确的状态,您可以说是并让它将旧状态复制到新状态,那么这个错误将不会再次出现。

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/967043

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档