From 4237db6886aeae219f256ae7ba086de38c1a3e1a Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Wed, 6 Jun 2018 11:40:18 -0400 Subject: [PATCH] aws_eks_cluster: Ensure arn is available as an attribute --- aws/data_source_aws_eks_cluster.go | 4 ++++ aws/data_source_aws_eks_cluster_test.go | 1 + aws/resource_aws_eks_cluster.go | 4 ++++ aws/resource_aws_eks_cluster_test.go | 1 + 4 files changed, 10 insertions(+) diff --git a/aws/data_source_aws_eks_cluster.go b/aws/data_source_aws_eks_cluster.go index 5c02ff7222c..c2dfbdfaf0f 100644 --- a/aws/data_source_aws_eks_cluster.go +++ b/aws/data_source_aws_eks_cluster.go @@ -15,6 +15,10 @@ func dataSourceAwsEksCluster() *schema.Resource { Read: dataSourceAwsEksClusterRead, Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, "certificate_authority": { Type: schema.TypeList, MaxItems: 1, diff --git a/aws/data_source_aws_eks_cluster_test.go b/aws/data_source_aws_eks_cluster_test.go index f07d30eb304..d224540029c 100644 --- a/aws/data_source_aws_eks_cluster_test.go +++ b/aws/data_source_aws_eks_cluster_test.go @@ -21,6 +21,7 @@ func TestAccAWSEksClusterDataSource_basic(t *testing.T) { { Config: testAccAWSEksClusterDataSourceConfig_Basic(rName), Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(resourceName, "arn", dataSourceResourceName, "arn"), resource.TestCheckResourceAttr(dataSourceResourceName, "certificate_authority.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "certificate_authority.0.data", dataSourceResourceName, "certificate_authority.0.data"), resource.TestCheckResourceAttrPair(resourceName, "created_at", dataSourceResourceName, "created_at"), diff --git a/aws/resource_aws_eks_cluster.go b/aws/resource_aws_eks_cluster.go index 23cac4b01bb..87abe5115f2 100644 --- a/aws/resource_aws_eks_cluster.go +++ b/aws/resource_aws_eks_cluster.go @@ -28,6 +28,10 @@ func resourceAwsEksCluster() *schema.Resource { }, Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, "certificate_authority": { Type: schema.TypeList, MaxItems: 1, diff --git a/aws/resource_aws_eks_cluster_test.go b/aws/resource_aws_eks_cluster_test.go index a15c0892957..583f90d11ab 100644 --- a/aws/resource_aws_eks_cluster_test.go +++ b/aws/resource_aws_eks_cluster_test.go @@ -86,6 +86,7 @@ func TestAccAWSEksCluster_basic(t *testing.T) { Config: testAccAWSEksClusterConfig_Required(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEksClusterExists(resourceName, &cluster), + resource.TestMatchResourceAttr(resourceName, "arn", regexp.MustCompile(fmt.Sprintf("^arn:[^:]+:eks:[^:]+:[^:]+:cluster/%s$", rName))), resource.TestCheckResourceAttr(resourceName, "certificate_authority.#", "1"), resource.TestCheckResourceAttrSet(resourceName, "certificate_authority.0.data"), resource.TestMatchResourceAttr(resourceName, "endpoint", regexp.MustCompile(`^https://`)),