【问题标题】:Unable to retrieve terraform state as S3 bucket deleted由于 S3 存储桶已删除,无法检索 terraform 状态
【发布时间】:2019-04-30 19:39:11
【问题描述】:

我通常更喜欢将我的状态文件存储到远程,即 S3。这次我做噩梦恢复状态,因为 S3 存储桶被删除了。虽然,我在本地有状态文件,但它没有用。我收到此错误:

$ terraform init -reconfigure
Initializing modules...
- module.ca
- module.etcd
- module.master
- module.network
- module.node
- module.output-store
- module.rds

Initializing the backend...
Error inspecting states in the "s3" backend:
    NoSuchBucket: The specified bucket does not exist
        status code: 404, request id: 30937B3sdfsd16F978120, host id: 3lOPzk8+Me+7NHgmC+YCTJBNXH34t0rLUdm9lYU/mkuDsdAWFEp+zbwUZzOL4wgXnREY4OFTDpbv69cwk=

Prior to changing backends, Terraform inspects the source and destination
states to determine what kind of migration steps need to be taken, if any.
Terraform failed to load the states. The data in both the source and the
destination remain unmodified. Please resolve the above error and try again. 

terraform 有没有办法在没有重新配置选项的情况下再次强制后端到本地,以便它开始考虑本地的状态文件?请指教。

【问题讨论】:

    标签: amazon-web-services amazon-s3 terraform


    【解决方案1】:

    创建 s3 存储桶并从本地上传您的状态文件

    【讨论】:

      【解决方案2】:

      即使您使用远程状态选项,仍然会在本地保存一些状态。它存储在.terraform/terraform.tfstate 文件中。您可以删除整个目录(这将重新下载所有模块和提供程序),也可以从状态或整个文件中删除 backend 键。

      【讨论】:

        猜你喜欢
        • 2017-11-16
        • 2017-06-08
        • 2014-11-03
        • 1970-01-01
        • 2021-12-12
        • 1970-01-01
        • 2023-03-24
        • 1970-01-01
        • 2019-04-29
        相关资源
        最近更新 更多