-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
aws_eks_cluster created_at timestamp is not what it supposed to be #24183
Comments
I have the exact same use case at @swisspost to workaround terraform-aws-modules/terraform-aws-eks#2076 ;-) @endrec
|
I'm formatting the date with the first pattern below but I suspect that the date is always UTC so it could be simplified to the second pattern. locals {
cluster_created_at = replace(replace(aws_eks_cluster.default.created_at, "/^(\\d{4}-\\d{2}-\\d{2})\\s(\\d{2}:\\d{2}:\\d{2})\\.\\d+\\s(\\+\\d{4}).+$/", "$${1}T$${2}$${3}"), "+0000", "Z")
} locals {
cluster_created_at = replace(aws_eks_cluster.default.created_at, "/^(\\d{4}-\\d{2}-\\d{2})\\s(\\d{2}:\\d{2}:\\d{2}).+$/", "$${1}T$${2}Z")
} The actual fix would be pretty simple, the following code would need to be modified to use the correct format.
d.Set("created_at", aws.TimeValue(cluster.CreatedAt).Format(time.RFC3339)) |
@endrec is this still an issue or can we close this out now? |
@bryantbiggs it's still an issue for me as the suggest patch above or an alternative hasn't been applied. |
Warning This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them. Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed. |
This functionality has been released in v5.67.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
Does not really matter, it seems to be the same from the beginning of time...
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Expected Behavior
According to the documentation (https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/eks_cluster),
data.aws_eks_cluster.cluster.created_at
should be aUnix epoch time stamp in seconds
.Actual Behavior
data.aws_eks_cluster.cluster.created_at
returns a string, in a format which is not even compatible withformatdate
.Steps to Reproduce
export TF_VAR_cluster_id=<your cluster id>
terraform apply
Important Factoids
My use case: EKS clusters created before April 16, 2020 require AmazonEKSServicePolicy, so I wanted to compare my cluster's creation date to decide if it needs this policy, or not.
Workaround:
tonumber(replace(substr(data.aws_eks_cluster.cluster.created_at, 0, 10), "-", "")) < 20200416
, which works with the format now, but as it is not a standard format, nothing guarantees it won't break in the next version.References
The text was updated successfully, but these errors were encountered: