diff --git a/aws/data_source_aws_eks_cluster.go b/aws/data_source_aws_eks_cluster.go index c2dfbdfaf0f3..b9d66b90c16d 100644 --- a/aws/data_source_aws_eks_cluster.go +++ b/aws/data_source_aws_eks_cluster.go @@ -46,6 +46,10 @@ func dataSourceAwsEksCluster() *schema.Resource { ForceNew: true, ValidateFunc: validation.NoZeroValues, }, + "platform_version": { + Type: schema.TypeString, + Computed: true, + }, "role_arn": { Type: schema.TypeString, Computed: true, @@ -110,6 +114,7 @@ func dataSourceAwsEksClusterRead(d *schema.ResourceData, meta interface{}) error d.Set("created_at", aws.TimeValue(cluster.CreatedAt).String()) d.Set("endpoint", cluster.Endpoint) d.Set("name", cluster.Name) + d.Set("platform_version", cluster.PlatformVersion) d.Set("role_arn", cluster.RoleArn) d.Set("version", cluster.Version) diff --git a/aws/data_source_aws_eks_cluster_test.go b/aws/data_source_aws_eks_cluster_test.go index d224540029c7..5153e89e4209 100644 --- a/aws/data_source_aws_eks_cluster_test.go +++ b/aws/data_source_aws_eks_cluster_test.go @@ -2,6 +2,7 @@ package aws import ( "fmt" + "regexp" "testing" "github.com/hashicorp/terraform/helper/acctest" @@ -26,6 +27,7 @@ func TestAccAWSEksClusterDataSource_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "certificate_authority.0.data", dataSourceResourceName, "certificate_authority.0.data"), resource.TestCheckResourceAttrPair(resourceName, "created_at", dataSourceResourceName, "created_at"), resource.TestCheckResourceAttrPair(resourceName, "endpoint", dataSourceResourceName, "endpoint"), + resource.TestMatchResourceAttr(resourceName, "platform_version", regexp.MustCompile(`^eks\.\d+$`)), resource.TestCheckResourceAttrPair(resourceName, "role_arn", dataSourceResourceName, "role_arn"), resource.TestCheckResourceAttrPair(resourceName, "version", dataSourceResourceName, "version"), resource.TestCheckResourceAttr(dataSourceResourceName, "vpc_config.#", "1"), diff --git a/aws/resource_aws_eks_cluster.go b/aws/resource_aws_eks_cluster.go index 87abe5115f22..f2d1118893d0 100644 --- a/aws/resource_aws_eks_cluster.go +++ b/aws/resource_aws_eks_cluster.go @@ -59,6 +59,10 @@ func resourceAwsEksCluster() *schema.Resource { ForceNew: true, ValidateFunc: validation.NoZeroValues, }, + "platform_version": { + Type: schema.TypeString, + Computed: true, + }, "role_arn": { Type: schema.TypeString, Required: true, @@ -195,6 +199,7 @@ func resourceAwsEksClusterRead(d *schema.ResourceData, meta interface{}) error { d.Set("created_at", aws.TimeValue(cluster.CreatedAt).String()) d.Set("endpoint", cluster.Endpoint) d.Set("name", cluster.Name) + d.Set("platform_version", cluster.PlatformVersion) d.Set("role_arn", cluster.RoleArn) d.Set("version", cluster.Version) diff --git a/aws/resource_aws_eks_cluster_test.go b/aws/resource_aws_eks_cluster_test.go index 583f90d11abd..9bba6bf37fcb 100644 --- a/aws/resource_aws_eks_cluster_test.go +++ b/aws/resource_aws_eks_cluster_test.go @@ -91,6 +91,7 @@ func TestAccAWSEksCluster_basic(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, "certificate_authority.0.data"), resource.TestMatchResourceAttr(resourceName, "endpoint", regexp.MustCompile(`^https://`)), resource.TestCheckResourceAttr(resourceName, "name", rName), + resource.TestMatchResourceAttr(resourceName, "platform_version", regexp.MustCompile(`^eks\.\d+$`)), resource.TestMatchResourceAttr(resourceName, "role_arn", regexp.MustCompile(fmt.Sprintf("%s$", rName))), resource.TestMatchResourceAttr(resourceName, "version", regexp.MustCompile(`^\d+\.\d+$`)), resource.TestCheckResourceAttr(resourceName, "vpc_config.#", "1"), diff --git a/website/docs/d/eks_cluster.html.markdown b/website/docs/d/eks_cluster.html.markdown index 8d664aefa0c8..3f146be67739 100644 --- a/website/docs/d/eks_cluster.html.markdown +++ b/website/docs/d/eks_cluster.html.markdown @@ -38,6 +38,7 @@ output "kubeconfig-certificate-authority-data" { * `data` - The base64 encoded certificate data required to communicate with your cluster. Add this to the `certificate-authority-data` section of the `kubeconfig` file for your cluster. * `created_at` - The Unix epoch time stamp in seconds for when the cluster was created. * `endpoint` - The endpoint for your Kubernetes API server. +* `platform_version` - The platform version for the cluster. * `role_arn` - The Amazon Resource Name (ARN) of the IAM role that provides permissions for the Kubernetes control plane to make calls to AWS API operations on your behalf. * `version` - The Kubernetes server version for the cluster. * `vpc_config` - Nested attribute containing VPC configuration for the cluster. diff --git a/website/docs/r/eks_cluster.html.markdown b/website/docs/r/eks_cluster.html.markdown index 4d63463199ff..068d23a28cda 100644 --- a/website/docs/r/eks_cluster.html.markdown +++ b/website/docs/r/eks_cluster.html.markdown @@ -54,6 +54,7 @@ In addition to all arguments above, the following attributes are exported: * `certificate_authority` - Nested attribute containing `certificate-authority-data` for your cluster. * `data` - The base64 encoded certificate data required to communicate with your cluster. Add this to the `certificate-authority-data` section of the `kubeconfig` file for your cluster. * `endpoint` - The endpoint for your Kubernetes API server. +* `platform_version` - The platform version for the cluster. * `version` - The Kubernetes server version for the cluster. * `vpc_config` - Additional nested attributes: * `vpc_id` - The VPC associated with your cluster.