导入多个处于地形状态的现有资源需要很长时间



我正在尝试通过创建一个读取 AWS 资源的脚本来导入多个资源,然后使用 terraform import 导入 Terraform 状态文件。事实是,这需要很长时间,因为import命令在每次调用时都会上传对 S3 中远程状态的更改。您知道如何以不同的方式解决问题吗?

您可以尝试禁用远程状态(删除 S3 状态并保留副本以防万一(,然后将状态导入到本地路径,完成所有导入后,您可以再次配置后端并运行terraform init -reconfigure然后 terraform 会要求您将本地状态上传到 S3。

/Users/koe/.terraform-versions/terraform-0.9.11/terraform init -reconfigure
Initializing the backend...
Do you want to copy state from "local" to "s3"?
  Pre-existing state was found in "local" while migrating to "s3". No existing
  state was found in "s3". Do you want to copy the state from "local" to
  "s3"? Enter "yes" to copy and "no" to start with an empty state.
  Enter a value:

最新更新