Skip to content

Commit

Permalink
Merge pull request #39167 from bryantbiggs/fix/eks-cluster-created-at
Browse files Browse the repository at this point in the history
fix: EKS cluster `created_at` timestamp should be Unix epoch time stamp in seconds
  • Loading branch information
ewbankkit committed Sep 6, 2024
2 parents 433cf45 + 673fb9d commit c85310f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .changelog/24183.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:bug
data-source/aws_eks_cluster: Return `created_at` as an [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) formatted timestamp
```

```release-note:bug
resource/aws_eks_cluster: Return `created_at` as an [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) formatted timestamp
```
2 changes: 1 addition & 1 deletion internal/service/eks/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter
if cluster.OutpostConfig != nil {
d.Set("cluster_id", cluster.Id)
}
d.Set(names.AttrCreatedAt, aws.ToTime(cluster.CreatedAt).String())
d.Set(names.AttrCreatedAt, cluster.CreatedAt.Format(time.RFC3339))
if err := d.Set("enabled_cluster_log_types", flattenLogging(cluster.Logging)); err != nil {
return sdkdiag.AppendErrorf(diags, "setting enabled_cluster_log_types: %s", err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/service/eks/cluster_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ package eks

import (
"context"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
Expand Down Expand Up @@ -243,7 +243,7 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int
if cluster.OutpostConfig != nil {
d.Set("cluster_id", cluster.Id)
}
d.Set(names.AttrCreatedAt, aws.ToTime(cluster.CreatedAt).String())
d.Set(names.AttrCreatedAt, cluster.CreatedAt.Format(time.RFC3339))
if err := d.Set("enabled_cluster_log_types", flattenLogging(cluster.Logging)); err != nil {
return sdkdiag.AppendErrorf(diags, "setting enabled_cluster_log_types: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion internal/service/eks/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func TestAccEKSCluster_basic(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "certificate_authority.#", acctest.Ct1),
resource.TestCheckResourceAttrSet(resourceName, "certificate_authority.0.data"),
resource.TestCheckNoResourceAttr(resourceName, "cluster_id"),
resource.TestCheckResourceAttrSet(resourceName, names.AttrCreatedAt),
acctest.CheckResourceAttrRFC3339(resourceName, names.AttrCreatedAt),
resource.TestCheckResourceAttr(resourceName, "enabled_cluster_log_types.#", acctest.Ct0),
resource.TestCheckResourceAttr(resourceName, "encryption_config.#", acctest.Ct0),
resource.TestMatchResourceAttr(resourceName, names.AttrEndpoint, regexache.MustCompile(`^https://`)),
Expand Down

0 comments on commit c85310f

Please sign in to comment.