【问题标题】:Import several existing resources in Terraform state takes very long time在 Terraform 状态下导入几个现有资源需要很长时间
【发布时间】:2017-11-18 06:53:06
【问题描述】:

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

【问题讨论】:

  • 您可以导入到本地状态文件。
  • 然后推吧? @宝马
  • @BMW 我一直在尝试,但没有任何运气。该命令总是远程上传状态文件
  • 为什么?如果你不设置 s3 作为后端?

标签: terraform


【解决方案1】:

您可以尝试禁用远程状态(删除 S3 状态并保留副本以防万一),然后将状态导入本地路径,完成所有导入后,您可以再次配置后端并运行 @987654321 @ 然后 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:

【讨论】:

    猜你喜欢
    • 2021-05-25
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 2019-06-18
    • 1970-01-01
    • 2020-04-29
    • 2021-10-08
    • 1970-01-01
    相关资源
    最近更新 更多