【问题标题】:Terraform apply not saving data in the backendTerraform 应用不在后端保存数据
【发布时间】:2021-03-12 13:58:51
【问题描述】:

我在部署代码时正在运行 terraform apply。但是有这个错误 `保存状态失败:consul CAS 失败并出现事务错误:[0xc0008ac480]

Error: Failed to persist state to backend.

The error shown above has prevented Terraform from writing the updated state
to the configured backend. To allow for recovery, the state has been written
to the file "errored.tfstate" in the current working directory.

Running "terraform apply" again at this point will create a forked state,
making it harder to recover.

To retry writing this state, use the following command:
    terraform state push errored.tfstate`

当我第二次运行 terraform apply 时,我看到以下错误

 Error: Creating CloudWatch Log Group failed: ResourceAlreadyExistsException: The specified log group already exists:  The CloudWatch Log Group '/aws/kinesisfirehose/test-cloudfront-wafv2-logs' already exists.



Error: Error creating IAM Role test-pvcapture-cloudfront-wafv2-firehose: EntityAlreadyExists: Role with name test-pvcapture-cloudfront-wafv2-firehose already exists.
    status code: 409, request id: 0fd8fda2-88fe-4860-ba22-951573f74268



Error: Error creating WAFv2 IPSet: WAFDuplicateItemException: AWS WAF couldn’t perform the operation because some resource in your request is a duplicate of an existing one.

我正在使用的 Terraform 版本:

terraform --version
Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/aws v3.16.0

【问题讨论】:

  • 请问您可以用您正在使用的 Terraform 版本更新问题吗?
  • 我已经更新了上述问题中的版本信息。感谢您的回复!
  • 第二次运行的错误一点也不奇怪。这是第一次运行的警告消息所警告的内容。
  • 您的backend 配置是什么(注意不要提及凭据)?

标签: amazon-web-services terraform


【解决方案1】:

我找到了解决问题的方法。我们的后端内存空间不足。我们不得不清理后端的空间。之后,我必须运行“terraform import”来手动将资源添加到后端文件。由于问题也在生产中,我们无法运行“terraform destroy”。这解决了我的问题。

谢谢大家!!

【讨论】:

    猜你喜欢
    • 2018-01-08
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 2019-11-06
    • 1970-01-01
    • 1970-01-01
    • 2021-04-07
    • 1970-01-01
    相关资源
    最近更新 更多