由于时间不匹配,地形应用失败 [英] Terraform apply failed due to mismatch time

查看:100
本文介绍了由于时间不匹配,地形应用失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用gitlab-ci将我的基础架构更改与CI管道中terraform的docker映像一起应用。但是,我收到一些与计时有关的错误。我有点怀疑某个地方的时间漂移​​吗?



我尝试设置时区并安装NTP并同步时区。我确认时间和TZ已从默认的UTC更改为本地时区GMT + 8。但是,该错误仍然会发生。



注意到时间从20秒缩短到8h,所以内部时钟似乎有问题吗?



如果这是terraform问题或docker问题,或两者兼而有之,我有点困惑?任何帮助将不胜感激。谢谢。


module.ecs_singapore.network.aws_nat_gateway.main:仍在创建... (经过20秒)
module.ecs_singapore.aws_alb.main:仍在创建... (已过去20秒)



module.ecs_singapore.network。 aws_nat_gateway.main:仍在创建... (经过8h0m7s)
module.ecs_singapore.aws_alb.main:仍在创建... (经过8h0m8s)



保存状态失败:上传状态失败:RequestTimeTooSkewed:请求时间与当前时间之间的差太大。
状态码:403,请求ID:0B0026E03C66248C,主机ID:n4DuSL4lWCUY0uXCLecwNtOyszV / Pr6ucFMZYxr4TjMuPWNHz2UYtuziy5dysFpJncWdwss1XTo =


释放状态

错误消息:无法检索锁定信息:InvalidSignatureException:签名尚未最新:20181206T223022Z仍晚于20181206T144544Z(20181206T143044Z + 15分钟。)
状态码:400,请求ID:G5CBO6G31177HOF9IB22HKEQDBVV4JQNSO5AE / p>

Terraform在访问您的状态时获得了一个锁,以防止其他运行Terraform的
可能同时修改状态。释放此锁定时发生
错误。这可能意味着
锁已正确释放或未正确释放。如果未正确释放锁,则
Terraform可能无法运行将来的命令,因为它将看起来像是已持有该锁的



解决方案

对我来说,根本原因是ESXi主机中的时间设置不正确。错误的时间被同步到其中运行的所有VM,这导致了此问题。一旦我将其设置为正确的UTC时间,一切都会正常。


I am trying to apply my infra changes with terraform's docker image from my CI pipeline using gitlab-ci. However, i am getting some timing related errors. I kind of suspect some kind of time drift somewhere?

I have tried setting timezone and installing NTP and synching the timezone. I verified that the time and TZ has changed from the default UTC to my local timezone GMT+8. However, the error still occurs.

Notice that the time elpased went from 20s to 8h so it seems to be there are some problem with the internal clock?

I am kind of confused if this is a terraform issue or docker issue or both? Any help will be greatly appreciated. Thank you.

module.ecs_singapore.network.aws_nat_gateway.main: Still creating... (20s elapsed) module.ecs_singapore.aws_alb.main: Still creating... (20s elapsed)

module.ecs_singapore.network.aws_nat_gateway.main: Still creating... (8h0m7s elapsed) module.ecs_singapore.aws_alb.main: Still creating... (8h0m8s elapsed)

Failed to save state: failed to upload state: RequestTimeTooSkewed: The difference between the request time and the current time is too large. status code: 403, request id: 0B0026E03C66248C, host id: n4DuSL4lWCUY0uXCLecwNtOyszV/Pr6ucFMZYxr4TjMuPWNHz2UYtuziy5dysFpJncWdwss1XTo=

Error releasing the state lock!

Error message: failed to retrieve lock info: InvalidSignatureException: Signature not yet current: 20181206T223022Z is still later than 20181206T144544Z (20181206T143044Z + 15 min.) status code: 400, request id: G5CBO6G31177HOF9IB22HKEQDBVV4KQNSO5AEMVJF66Q9ASUAAJG

Terraform acquires a lock when accessing your state to prevent others running Terraform to potentially modify the state at the same time. An error occurred while releasing this lock. This could mean that the lock did or did not release properly. If the lock didn't release properly, Terraform may not be able to run future commands since it'll appear as if the lock is held.

解决方案

The root cause for me was an incorrect time setting in my ESXi host. That wrong time is being synched to all the VMs running in it, which resulted in this issue. Everything work fine once i set it back to the right UTC time.

这篇关于由于时间不匹配,地形应用失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆