Skip to content

Commit

Permalink
fix: lint and documentation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoshi123 committed Jan 12, 2025
1 parent 1488798 commit 86b1554
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 20 deletions.
10 changes: 7 additions & 3 deletions internal/service/eks/cluster_versions_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ func (d *dataSourceClusterVersions) Schema(ctx context.Context, req datasource.S
"cluster_type": schema.StringAttribute{
Optional: true,
},
"default_only": schema.BoolAttribute{
Optional: true,
},
"cluster_versions_only": schema.ListAttribute{
Optional: true,
CustomType: fwtypes.ListOfStringType,
},
"default_only": schema.BoolAttribute{
Optional: true,
},
"include_all": schema.BoolAttribute{
Optional: true,
},
names.AttrStatus: schema.StringAttribute{
Optional: true,
CustomType: fwtypes.StringEnumType[clusterVersionAWSStatus](),
Expand Down Expand Up @@ -141,6 +144,7 @@ func (clusterVersionAWSStatus) Values() []clusterVersionAWSStatus {
type dataSourceClusterVersionsModel struct {
ClusterType types.String `tfsdk:"cluster_type"`
DefaultOnly types.Bool `tfsdk:"default_only"`
IncludeAll types.Bool `tfsdk:"include_all"`
ClusterVersionsOnly fwtypes.ListValueOf[types.String] `tfsdk:"cluster_versions_only"`
Status fwtypes.StringEnum[clusterVersionAWSStatus] `tfsdk:"status"`
ClusterVersions fwtypes.ListNestedObjectValueOf[customDataSourceClusterVersion] `tfsdk:"cluster_versions"`
Expand Down
32 changes: 31 additions & 1 deletion internal/service/eks/cluster_versions_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestAccEKSClusterVersionsDataSource_basic(t *testing.T) {
Config: testAccClusterVersionsDataSourceConfig_basic(),
Check: resource.ComposeAggregateTestCheckFunc(
acctest.CheckResourceAttrGreaterThanValue(dataSourceName, "cluster_versions.#", 0),
acctest.CheckResourceAttrContains(dataSourceName, "cluster_versions.0.default_version", "true"),
acctest.CheckResourceAttrContains(dataSourceName, "cluster_versions.0.default_version", acctest.CtTrue),
),
},
},
Expand Down Expand Up @@ -66,6 +66,28 @@ func TestAccEKSClusterVersionsDataSource_defaultOnly(t *testing.T) {
Config: testAccClusterVersionsDataSourceConfig_defaultOnly(),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(dataSourceName, "cluster_versions.#", "1"),
acctest.CheckResourceAttrContains(dataSourceName, "cluster_versions.0.default_version", acctest.CtTrue),
),
},
},
})
}

func TestAccEKSClusterVersionsDataSource_status(t *testing.T) {
ctx := acctest.Context(t)

dataSourceName := "data.aws_eks_cluster_versions.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, names.EKSServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
Steps: []resource.TestStep{
{
Config: testAccClusterVersionsDataSourceConfig_status(),
Check: resource.ComposeTestCheckFunc(
acctest.CheckResourceAttrGreaterThanValue(dataSourceName, "cluster_versions.#", 0),
acctest.CheckResourceAttrContains(dataSourceName, "cluster_versions.0.status", "STANDARD_SUPPORT"),
),
},
},
Expand Down Expand Up @@ -94,3 +116,11 @@ data "aws_eks_cluster_versions" "test" {
}
`)
}

func testAccClusterVersionsDataSourceConfig_status() string {
return acctest.ConfigCompose(`
data "aws_eks_cluster_versions" "test" {
status = "STANDARD_SUPPORT"
}
`)
}
33 changes: 17 additions & 16 deletions website/docs/d/eks_cluster_versions.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@ page_title: "AWS: aws_eks_cluster_versions"
description: |-
Terraform data source for managing an AWS EKS (Elastic Kubernetes) Cluster Versions.
---
<!---
TIP: A few guiding principles for writing documentation:
1. Use simple language while avoiding jargon and figures of speech.
2. Focus on brevity and clarity to keep a reader's attention.
3. Use active voice and present tense whenever you can.
4. Document your feature as it exists now; do not mention the future or past if you can help it.
5. Use accessible and inclusive language.
--->

# Data Source: aws_eks_cluster_versions

Expand All @@ -23,24 +15,33 @@ Terraform data source for managing an AWS EKS (Elastic Kubernetes) Cluster Versi
### Basic Usage

```terraform
data "aws_eks_cluster_versions" "example" {}
data "aws_eks_cluster_versions" "example" {
cluster_type = "eks"
}
```

## Argument Reference

The following arguments are required:

* `example_arg` - (Required) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information.

The following arguments are optional:

* `optional_arg` - (Optional) Concise argument description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information.
* `cluster_type` - (Optional) The type of clusters to filter by. Currently only `eks` is supported.
* `default_only` - (Optional) Whether to show only the default versions of Kubernetes supported by EKS. Default is `false`.
* `cluster_versions` - (Optional) A list of Kubernetes versions that you can use to check if EKS supports it.
* `include_all` - (Optional) Whether to include all kubernetes versions in the response. Default is `false`.
* `status` - (Optional) The status of the EKS cluster versions to list. Can be `STANDARD_SUPPORT` or `UNSUPPORTED` or `EXTENDED_SUPPORT`.

## Attribute Reference

This data source exports the following attributes in addition to the arguments above:

* `arn` - ARN of the Cluster Versions. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information.
* `example_attribute` - Concise description. Do not begin the description with "An", "The", "Defines", "Indicates", or "Specifies," as these are verbose. In other words, "Indicates the amount of storage," can be rewritten as "Amount of storage," without losing any information.
* `tags` - Map of tags assigned to the resource.
* `cluster_version` - The Kubernetes version supported by EKS.
* `cluster_type` - The type of cluster that the version belongs to. Currently only `eks` is supported.
* `default_platform_version` - The default eks platform version for the cluster version.
* `default_version` - The default Kubernetes version for the cluster version.
* `status` - The status of the EKS cluster version. Can be `STANDARD_SUPPORT` or `UNSUPPORTED` or `EXTENDED_SUPPORT`.
* `end_of_extended_support_date` - The end of extended support date for the cluster version.
* `end_of_standard_support_date` - The end of standard support date for the cluster version.
* `kubernetes_patch_version` - The Kubernetes patch version for the cluster version.
* `release_date` - The release date of the cluster version.

0 comments on commit 86b1554

Please sign in to comment.