New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Terraform apply failed due to mismatch time #19622
Comments
Hi @joonhwa, Terraform computes that This seems confirmed by the final error that is complaining that the timestamp used in the signature is "not yet current". Terraform itself does not make any changes to your host system clock, so something outside of Terraform must be doing it. Since both the AWS SDK and Terraform itself are using UTC timestamps for this comparision, this suggests some confusion on your system about what timezone the system clock is in. On Unix systems, the system clock is usually in UTC and then offset to local time only for display purposes, while on Windows systems the system clock may be in local time and require an offset to be applied to recover UTC. It seems like something else on your system switched the system clock from UTC to local or vice-versa while Terraform was running. When Docker is running on Linux it lives inside the same kernel as the "host" and so there should only be one system clock. But when Docker runs on non-Linux platforms it runs in a virtual machine that may virtualize the system clock on the host by applying an offset to it. I don't know why this offset would change during runtime; I can only assume there's some other software running either on the host or in the container that reset the system time. I can't think of any way this could be a Terraform issue, since both Terraform and the AWS provider are just asking the host OS for the current time and trusting what they are told. |
Thanks alot for the detailed explanation @apparentlymart The root cause for me is an incorrect time setting in my ESXi host. That wrong time is being synched to all the VM running in it, which resulted in this issue. Everything work fine once i set it back to the right UTC time. |
Thanks for following up, @joonhwa! I'm glad you found the answer. Since this wasn't a Terraform issue, I'm going to close this out. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform Configuration Files
Expected Behavior
Continue to wait for resource to be created then move on to other resource
Actual Behavior
Operation failed with an error message stating mismatch time.
Steps to Reproduce
terraform init
terraform plan
terraform apply
Additional Context
I am running this with terraform's docker image from my CI pipeline using gitlab-ci. 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.
I am kind of confused if this is a terraform issue or docker issue or both?
Any help will be greatly appreciated.
The text was updated successfully, but these errors were encountered: