jenkins-x / terraform-aws-eks-jx

A Terraform module for creating Jenkins X infrastructure on AWS
Apache License 2.0
63 stars 43 forks source link

Error when calling the DescribeCluster operation: No cluster found for name: tf-jx-sound-seagull #108

Closed troyhart closed 4 years ago

troyhart commented 4 years ago

Summary

I followed the instruction here to create a cluster: https://jenkins-x.io/docs/install-setup/create-cluster/eks/

terraform apply takes an ample amount time to process before ending with the error indicated in the title.

A cluster was created in the us-east-1 region and I can get the vault user id and secret plus the jx-requirements.yml from terraform, so it partially worked.

Steps to reproduce the behavior

  1. Meet the pre-reqs from the instructions
  2. Create an empty directory.
  3. Add a file named main.tf with the content specified below
  4. terraform init
  5. terraform apply

main.tf

module "eks-jx" {
  source  = "jenkins-x/eks-jx/aws"
}

output "jx_requirements" {
   value = module.eks-jx.jx_requirements
}

output "vault_user_id" {
  value       = module.eks-jx.vault_user_id
  description = "The Vault IAM user id"
}

output "vault_user_secret" {
  value       = module.eks-jx.vault_user_secret
  description = "The Vault IAM user secret"
}

Expected behavior

Create the AWS EKS cluster without producing an error message.

Actual behavior

Cluster created in AWS, in unknown condition.

Terraform version

The output of terraform version is:

Terraform v0.12.28

Module version

1.3.0

Operating system

Ubuntu 18.04.4

ankitm123 commented 4 years ago

Looking at this PR: #110, you need to add the region. See this: https://github.com/jenkins-x/terraform-aws-eks-jx/pull/110#discussion_r452746116

troyhart commented 4 years ago

That didn't address the issue. I added the provider block for aws specifying us-east-1 as the note indicated to do in PR #110. My new main.tf is as follows:

module "eks-jx" {
  source  = "jenkins-x/eks-jx/aws"
}

provider "aws" {
  region  = "us-east-1"
}

output "jx_requirements" {
   value = module.eks-jx.jx_requirements
}

output "vault_user_id" {
  value       = module.eks-jx.vault_user_id
  description = "The Vault IAM user id"
}

output "vault_user_secret" {
  value       = module.eks-jx.vault_user_secret
  description = "The Vault IAM user secret"
}

output "tekton_bot_iam_role" {
  value       = module.eks-jx.tekton_bot_iam_role
  description = "The Tekton Bot IAM user role"
}

I didn't know exactly what to do next so I just tried execute terraform apply again. That also didn't work for the same reason (cluster not found). Next, I executed terraform destroy then I deleted all the terraform state in the directory with my main.tf, including the hidden .terraform/ directory. Then I executed terraform init followed by terraform apply and once again it fails for the same reason: module.eks-jx.module.cluster.null_resource.kubeconfig (local-exec): An error occurred (ResourceNotFoundException) when calling the DescribeCluster operation: No cluster found for name: tf-jx-meet-sheepdog.

ankitm123 commented 4 years ago

What do you see when you run:

aws eks list-clusters

May be issues with cli using wrong profile/account?

troyhart commented 4 years ago
‣‣ aws eks list-clusters
{
    "clusters": []
}
troyhart commented 4 years ago

And yet at the same time, this is the view from the aws web ui image

ankitm123 commented 4 years ago

That explains it. Pretty sure it's a wrong profile/account. Which profile are you using? Should be in your .aws/credentials file. After you find that, try:

aws eks list-clusters --profile <right-profile> --region us-east-1
troyhart commented 4 years ago
‣‣ aws eks list-clusters --profile default --region us-east-1
{
    "clusters": [
        "tf-jx-meet-sheepdog"
    ]
}
ankitm123 commented 4 years ago

So, if you try:

AWS_PROFILE=default AWS_REGION=us-east-1 terraform apply

I think it will work. Let me know.

troyhart commented 4 years ago

YEAH!!!!!!!!

That worked! Thanks!

ankitm123 commented 4 years ago

Probably need to look at why terraform cannot source it from the credentials file, but this is not a blocker. So going to close this.

/close

jenkins-x-bot commented 4 years ago

@ankitm123: Closing this issue.

In response to [this](https://github.com/jenkins-x/terraform-aws-eks-jx/issues/108#issuecomment-656826587): >Probably need to look at why terraform cannot source it from the credentials file, but this is not a blocker. So going to close this. > >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository.