简体   繁体   English

S3存储桶已删除,无法检索地形状态

[英]Unable to retrieve terraform state as S3 bucket deleted

I usually prefer storing my statefiles to remote ie S3. 我通常更喜欢将状态文件存储到远程即S3。 This time I'm having a nightmare recovering the state as somehow the S3 bucket got deleted. 这次我在噩梦中恢复状态,因为S3存储桶被删除了。 Although, I have the statefile locally but it's of no use. 虽然,我在本地有状态文件,但没有用。 I get this error: 我收到此错误:

$ 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. 

Is there a way in terraform to force the backend to local again without the reconfigure option, so that it starts considering the statefile in local ? terraform中是否有一种方法可以在不使用reconfigure选项的情况下将后端再次强制为local,从而开始考虑local中的statefile? Please advise. 请指教。

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

Even when you are using the remote state option there is still a little bit of state that is saved locally. 即使在使用远程状态选项时,仍然会在本地保存一些状态。 It is stored in the .terraform/terraform.tfstate file. 它存储在.terraform/terraform.tfstate文件中。 You can either delete the whole directory(that will reaquire downloading all the modules and providers) or just delete the backend key from state or the whole file. 您可以删除整个目录(将需要下载所有模块和提供程序),也可以仅从状态或整个文件中删除backend密钥。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM