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

[Bug]: new eks-cluster example fails when running in a region with only 3 az's #191

Open
1 task done
lewinkedrs opened this issue Jul 13, 2023 · 0 comments
Open
1 task done
Assignees
Labels
bug Something isn't working

Comments

@lewinkedrs
Copy link
Contributor

Welcome to the AWS Observability Accelerator

  • Yes, I've searched similar issues on GitHub and didn't find any.

AWS Observability Accelerator Release version

latest

What is your environment, configuration and the example used?

When running the eks-cluster-with-vpc example we use this in main.tf:

data "aws_availability_zones" "available" {}

locals {
  name         = basename(path.cwd)
  cluster_name = coalesce(var.cluster_name, local.name)
  region       = var.aws_region

  vpc_cidr = "10.0.0.0/16"
  azs      = slice(data.aws_availability_zones.available.names, 0, 3)

If you run this in a region with only 3 AZs like us-west-1 you get an error because the end value of the slice (3) exceeds the amount of items in the list (2) These are zero-indexed: If you change the above code to this:

data "aws_availability_zones" "available" {}

locals {
  name         = basename(path.cwd)
  cluster_name = coalesce(var.cluster_name, local.name)
  region       = var.aws_region

  vpc_cidr = "10.0.0.0/16"
  azs      = slice(data.aws_availability_zones.available.names, 0, 2)

You no longer get the error. We probably should read the amount of items in the 'aws_availability_zones' list and use that to set the end value of the slice.

What did you do and What did you see instead?

This worked in us-west-1 by manually changing slice index.

Additional Information

No response

@lewinkedrs lewinkedrs added the bug Something isn't working label Jul 13, 2023
@lewinkedrs lewinkedrs self-assigned this Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant