Skip to content

Commit

Permalink
aws_eks_cluster_auth test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarrien committed Feb 6, 2019
1 parent 797297f commit 28a811f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions aws/data_source_aws_eks_cluster_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,22 @@ func testAccCheckAwsEksClusterAuthToken(n string) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Can't find EKS Cluster Auth resource: %s", n)
return fmt.Errorf("Not found: %s", n)
}

if rs.Primary.ID == "" {
return fmt.Errorf("EKS Cluster Auth resource ID not set")
return fmt.Errorf("No resource ID is set")
}

name := rs.Primary.Attributes["name"]
tok := rs.Primary.Attributes["token"]
verifier := token.NewVerifier(name)
identity, err := verifier.Verify(tok)
if err != nil {
return fmt.Errorf("Error verifying token for cluster %q: %v", name, err)
}
if identity.ARN == "" {
return fmt.Errorf("Received unexpected blank ARN for token identity")
return fmt.Errorf("Unexpected blank ARN for token identity")
}

return nil
Expand Down

0 comments on commit 28a811f

Please sign in to comment.