Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Your query returned no results" - when looking for AMI in cn-northwest-1 #824

Closed
1 of 4 tasks
byakku opened this issue Mar 31, 2020 · 11 comments
Closed
1 of 4 tasks

Comments

@byakku
Copy link

byakku commented Mar 31, 2020

I have issues

Cannot locate AMI and not able to provide search query for EKS AMI

I'm submitting a...

  • bug report
  • feature request
  • support request - read the FAQ first!
  • kudos, thank you, warm fuzzy

What is the current behavior?

Currenly during plan I'm getting error:

Error: Your query returned no results. Please change your search criteria and try again.

  on .terraform/modules/eks/terraform-aws-modules-terraform-aws-eks-ca3d1e1/data.tf line 25, in data "aws_ami" "eks_worker":
  25: data "aws_ami" "eks_worker" {


Error: Your query returned no results. Please change your search criteria and try again.

  on .terraform/modules/eks/terraform-aws-modules-terraform-aws-eks-ca3d1e1/data.tf line 36, in data "aws_ami" "eks_worker_windows":
  36: data "aws_ami" "eks_worker_windows" {

If this is a bug, how to reproduce? Please include a code sample if relevant.

Slightly changed version of examples/basic

provider "kubernetes" {
  host                   = data.aws_eks_cluster.cluster.endpoint
  cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority.0.data)
  token                  = data.aws_eks_cluster_auth.cluster.token
  load_config_file       = false
  version                = "~> 1.11"
}

[...]
locals {

  cluster_name       = "cnnw-prod"
  vpc_id             = "vpc-[redacted]"
  kubernetes_version = "1.15"
  worker_ami_name_filter = "amazon-eks-gpu-node-*"
  subnets = [
    "subnet-[redacted]",
    "subnet-[redacted]",
    "subnet-[redacted]",
  ]

  workers_groups_defaults = {
    autoscaling_enabled                      = true
    key_name                                 = "dev"
    on_demand_percentage_above_base_capacity = "0"
    public_ip                                = true
    root_volume_size                         = 80
    subnets                                  = local.subnets
    ami_id                                   = "ami-0dbb95bf745015b04"
  }
}

[...]
module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  version         = "10.0.0"
  cluster_name    = local.cluster_name
  cluster_version = local.kubernetes_version
  cluster_endpoint_public_access  = true
  cluster_endpoint_private_access = true
  subnets         = local.subnets
  vpc_id = local.vpc_id

  cluster_enabled_log_types = ["audit", "authenticator", "controllerManager"]

  manage_worker_iam_resources              = true
  manage_cluster_iam_resources             = true


  tags = {
    Environment = "test"
  }

  worker_groups_launch_template = [
    {
      name                    = "r-xlarge-spot"
      override_instance_types = ["r3.xlarge", "r4.xlarge", "r5.xlarge", "r5a.xlarge"]
      spot_instance_pools     = 2
      asg_max_size            = 8
      asg_min_size            = 0
      asg_desired_capacity    = 2
      kubelet_extra_args      = "--node-labels=kubernetes.io/lifecycle=spot"
      public_ip               = true
      autoscalling_enabled    = true

    },

What's the expected behavior?

I expected terraform to successfully query the AWS for AMI. I'm using very old version of EKS module that works with more simple configuration so I believe errors that occur are because misconfiguration but couldn't manage to get it working.

Environment details

  • Affected module version: 10.0.0
  • OS: Linux 64bit 5.5.13
  • Terraform version: v0.12.24

Any other relevant info

Region - cn-northwest-1

Providers:

  • provider.aws v2.54.0
  • provider.kubernetes v1.11.1
  • provider.local v1.4.0
  • provider.null v2.1.2
  • provider.random v2.2.1
  • provider.template v2.1.2
@barryib
Copy link
Member

barryib commented Apr 13, 2020

@byakku Does #827 resolve your issue ?

@riveryc
Copy link

riveryc commented Apr 23, 2020

@byakku @barryib
You will need to change your variables.tf

variable "worker_ami_owner_id" {
  description = "The ID of the owner for the AMI to use for the AWS EKS workers. Valid values are an AWS account ID, 'self' (the current account), or an AWS owner alias (e.g. 'amazon', 'aws-marketplace', 'microsoft')."
  type        = string
  default     = "961992271922" // The ID of the owner of the official AWS EKS AMIs.
}

variable "worker_ami_owner_id_windows" {
  description = "The ID of the owner for the AMI to use for the AWS EKS Windows workers. Valid values are an AWS account ID, 'self' (the current account), or an AWS owner alias (e.g. 'amazon', 'aws-marketplace', 'microsoft')."
  type        = string
  default     = "016951021795" // The ID of the owner of the official AWS EKS Windows AMIs.
}

@etsuo
Copy link

etsuo commented Apr 30, 2020

@riveryc in cn-north-1, even with the correct ownerIDs set, Your query returned no results. still results with version 1.16 cluster set.

I have no intention of ever hosting k8s on Windows, so spending time on resolving a config issue related to Windows is a bit frustrating.

@etsuo
Copy link

etsuo commented May 1, 2020

looks like this is now working with 1.16 in cn-north-1.

@toabi
Copy link

toabi commented May 26, 2020

It only works when manually setting the owner ids in china. Shouldn't the module take care of this?

@byakku
Copy link
Author

byakku commented May 27, 2020

EKS got postponed, extremely sorry for late response but I was dodging main GH page for too long.

When updated module error still persisted with Your query returned no results..

@marijnmur
Copy link

@byakku @barryib
You will need to change your variables.tf

variable "worker_ami_owner_id" {
  description = "The ID of the owner for the AMI to use for the AWS EKS workers. Valid values are an AWS account ID, 'self' (the current account), or an AWS owner alias (e.g. 'amazon', 'aws-marketplace', 'microsoft')."
  type        = string
  default     = "961992271922" // The ID of the owner of the official AWS EKS AMIs.
}

variable "worker_ami_owner_id_windows" {
  description = "The ID of the owner for the AMI to use for the AWS EKS Windows workers. Valid values are an AWS account ID, 'self' (the current account), or an AWS owner alias (e.g. 'amazon', 'aws-marketplace', 'microsoft')."
  type        = string
  default     = "016951021795" // The ID of the owner of the official AWS EKS Windows AMIs.
}

I needed to set the worker_ami_owner_id to "558608220178" for region me-south-1

@byakku
Copy link
Author

byakku commented Sep 7, 2020

cn-nw vars:

worker_ami_owner_id         = "961992271922"
worker_ami_owner_id_windows = "amazon"

cn-north

worker_ami_owner_id         = "918309763551"
worker_ami_owner_id_windows = "amazon"

With these in place, I successfully launched a cluster.

@homer6
Copy link

homer6 commented Apr 11, 2022

This happened for me in us-east-2. However, my problem is that I had used a k8s version that had not been supported yet. I had originally added k8s version 1.23 in the cluster_version terraform variable. Changing it to 1.22 solved the issue.

@darkn3rd
Copy link

darkn3rd commented May 17, 2022

I have this issue with us-east-2 as well. I am using the default K8s version, but changing it to 1.2.2 also solve the issue for me as well.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants