amazon-web-services - AWS 会话令牌在运行 terraform apply 时过期
问题描述
在 terraform 中使用 AWS 会话令牌。RDS 恢复需要一个多小时,同时会话令牌会过期。因此,tf 状态文件也没有在 s3 中更新。有没有办法在后台运行 tf apply 以便我们可以定期刷新令牌并且操作不会失败?
11:07:25 status code: 400, request id: PF3V9137RT1HVB3W, host id: SeXwAFlokygO5NjyKppBD/kYvFl/i9nrh81YSf7Szta6y5Wfd20ssxmFYYwhg+XysuPMvb1uuJo=
11:07:25
11:07:25
11:07:25 Error: Failed to persist state to backend.
11:07:25
11:07:25 The error shown above has prevented Terraform from writing the updated state
11:07:25 to the configured backend. To allow for recovery, the state has been written
11:07:25 to the file "errored.tfstate" in the current working directory.
11:07:25
11:07:25 Running "terraform apply" again at this point will create a forked state,
11:07:25 making it harder to recover.
11:07:25
11:07:25 To retry writing this state, use the following command:
11:07:25 terraform state push errored.tfstate
11:07:25
11:07:25
11:07:25
11:07:25 Releasing state lock. This may take a few moments...
11:07:30
11:07:30 Error releasing the state lock!
11:07:30
11:07:30 Error message: failed to retrieve lock info: ExpiredTokenException: The security token included in the request is expired
11:07:30 status code: 400, request id: C7JE11FDGLPTU672G4781LOR73VV4KQNSO5AEMVJF66Q9ASUAAJG
解决方案
通过将过程分为两个步骤来获得解决方法。当我创建一个多可用区 RDS 实例时,创建过程花费了大量时间。作为解决方案:
- 首先我们可以使用 terraform 创建一个单可用区实例。
- 然后再次使用它来修改实例成为多可用区。
这对我有用。
推荐阅读
- android - Android开发:Koltin -> 你如何使用你在xml中创建的id名称并在activity中调用它而不创建新的变量
- verifiable-c - 存在主义魔杖的意义何在?
- sql - SQL索引可以使搜索更长吗?
- c# - 对象在当前上下文中不存在?
- c# - 关于 AzureRM 和 C# 的几个问题
- coq - 试图在异构向量上定义一个类似“rect2”的函数
- java - 我如何找到特定长度的单词,忽略标点符号
- javascript - (节点:1788)UnhandledPromiseRejectionWarning:TypeError:无法读取未定义的属性“4”
- java - 如何在 HQL 中访问joined-subclass 的属性?
- c++ - 类型转换如何处理初始化“unsigned int i = -100”?