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

aws_lb resource not working with AWS provider 5.73.0+ #8314

Closed
jrindy-iterable opened this issue Nov 14, 2024 · 5 comments
Closed

aws_lb resource not working with AWS provider 5.73.0+ #8314

jrindy-iterable opened this issue Nov 14, 2024 · 5 comments

Comments

@jrindy-iterable
Copy link

Problem

The last version of the AWS provider that works with Moto for load balancers was AWS provider version 5.72.0. I think this may be related to the added attribute for the aws_lb resource in aws provider version 5.73.0+:

  • resource/aws_lb: Add enable_zonal_shift argument (#39585)
  • resource/aws_lb_listener: Add tcp_idle_timeout_seconds argument (#39585)

Let me know if you need anything additional from me. Thanks!

# Error in AWS provider version 5.73.0+

Error: modifying ELBv2 Load Balancer (arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/nlb-test/50dc6c495c0c9188) 
attributes: operation error Elastic Load Balancing v2: ModifyLoadBalancerAttributes, https response error StatusCode: 400, 
RequestID: dbCyKb4FCYUrIo1bWkk8F6zR9uehxkLUY6QzW4XFEuECIRV6G1OF, api error UnknownError: UnknownError

Reproduction

providers.tf

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      # version = "5.72.0" # 5.72.0 is the last version that works
    }
  }
}

provider "aws" {
  region                      = "us-east-1"
  s3_use_path_style           = true
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true

  endpoints {
    ec2   = "http://localhost:5000"
    elbv2 = "http://localhost:5000"
  }

  access_key = "my-access-key"
  secret_key = "my-secret-key"
}

nlb.tf

data "aws_vpc" "default" {
  default = true
}

data "aws_subnets" "all" {
  filter {
    name   = "vpc-id"
    values = [data.aws_vpc.default.id]
  }
}

resource "aws_lb" "this" {
  name                       = "nlb-test"
  internal                   = true
  load_balancer_type         = "network"
  subnets                    = data.aws_subnets.all.ids
  enable_deletion_protection = false
}

Expectation

I expect to be able to create an NLB (or any LB) with Terraform within Moto using the latest AWS provider version.

Current Setup

  moto-server:
    image: motoserver/moto:latest
    ports:
      - 5000:5000
    environment:
      - MOTO_IAM_LOAD_MANAGED_POLICIES=true
@bblommers
Copy link
Collaborator

Hi @jrindy-iterable, when's the last time you pulled down the latest image? Both changes should already be supported with Moto 5.0.19 (see https://github.com/getmoto/moto/pull/8263/files and https://github.com/getmoto/moto/pull/8280/files)

@jrindy-iterable
Copy link
Author

jrindy-iterable commented Nov 14, 2024

@bblommers I pulled new images as recently as today and just did a repull now and it says it is already up to date.

@bblommers
Copy link
Collaborator

Ah, right, looks like there is a problem with our release process - our 'latest' image isn't actually the latest.

It does work with the '5.0.19'-tag, but the 'latest' tag hasn't been updated in ages. I'll kick off a build now, so 'latest' should actually be the 'latest' (and contain this fix) in about 15 minutes.

@jrindy-iterable
Copy link
Author

Awesome, with the fixed latest tag it is now working for me as well. Thanks!

Side note: Is there a tag I should be using besides latest or is the latest tag fixed going forward?

@bblommers
Copy link
Collaborator

Happy to hear it's working now @jrindy-iterable!

You can continue using latest - the release process has been now fixed, so latest is updated automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants