diff --git a/.changelog/24183.txt b/.changelog/24183.txt new file mode 100644 index 00000000000..a352ba78074 --- /dev/null +++ b/.changelog/24183.txt @@ -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 +``` diff --git a/internal/service/eks/cluster.go b/internal/service/eks/cluster.go index 6321b6caa2a..36cbda1200a 100644 --- a/internal/service/eks/cluster.go +++ b/internal/service/eks/cluster.go @@ -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) } diff --git a/internal/service/eks/cluster_data_source.go b/internal/service/eks/cluster_data_source.go index 0eb35a6247e..ee930388d6a 100644 --- a/internal/service/eks/cluster_data_source.go +++ b/internal/service/eks/cluster_data_source.go @@ -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" @@ -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) } diff --git a/internal/service/eks/cluster_test.go b/internal/service/eks/cluster_test.go index a64056f7675..def9a2030ea 100644 --- a/internal/service/eks/cluster_test.go +++ b/internal/service/eks/cluster_test.go @@ -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://`)),