Skip to content

Commit

Permalink
Merge pull request #5797 from ewbankkit/issue-5796
Browse files Browse the repository at this point in the history
r/aws_eks_cluster, d/aws_eks_cluster: Add support for EKS Platform Version
  • Loading branch information
bflad authored Sep 5, 2018
2 parents d083103 + 5f4ec82 commit f0359b9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aws/data_source_aws_eks_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions aws/data_source_aws_eks_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package aws

import (
"fmt"
"regexp"
"testing"

"github.com/hashicorp/terraform/helper/acctest"
Expand All @@ -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"),
Expand Down
5 changes: 5 additions & 0 deletions aws/resource_aws_eks_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions aws/resource_aws_eks_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/eks_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/eks_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f0359b9

Please sign in to comment.