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

Ensure target group and load balancer names cannot exceed their max length #96

Merged
merged 7 commits into from
Aug 18, 2021

Conversation

nitrocode
Copy link
Member

@nitrocode nitrocode commented Aug 2, 2021

what

  • Ensure target group and load balancer names cannot exceed their max length
  • Expose *_max_length variables in case AWS changes their max length in the future
  • Override load_balancer_name, similar to target_group_name

why

  • To prevent exceeding the max lengths of the tg and lb so the module will be applied correctly

references

  • Closes ALB target group name is limited to 32 characters #27
  • API_CreateTargetGroup

    This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.

  • API_CreateLoadBalancer

    This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, must not begin or end with a hyphen, and must not begin with "internal-".

@nitrocode nitrocode requested review from a team as code owners August 2, 2021 21:10
@nitrocode nitrocode requested review from Gowiem and jamengual and removed request for a team August 2, 2021 21:10
Copy link

@bridgecrew bridgecrew bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bridgecrew has found 1 infrastructure configuration error in this PR ⬇️

id_length_limit = var.load_balancer_name_max_length
context = module.this.context
}

resource "aws_lb" "default" {
Copy link

@bridgecrew bridgecrew bot Aug 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOW   Ensure that ALB redirects HTTP requests into HTTPS ones
    Resource: aws_lb.default | ID: BC_AWS_NETWORKING_49

How to Fix

resource "aws_lb" "lb_good" {
}


resource "aws_lb_listener" "listener_good" {
  load_balancer_arn = aws_lb.lb_good.arn
  port              = "80"
  protocol          = "HTTP"

  default_action {
    type = "redirect"

    redirect {
      port        = "443"
      protocol    = "HTTPS"
      status_code = "HTTP_301"
    }

  }
}

Description

TBA

Dependent Resources



Path Resource Connecting Attribute
/main.tf aws_lb_listener.http_forward load_balancer_arn
/main.tf aws_lb_listener.http_redirect load_balancer_arn
/main.tf aws_lb_listener.https load_balancer_arn

@nitrocode nitrocode requested a review from a team as a code owner August 2, 2021 21:11
@nitrocode
Copy link
Member Author

/test all

@mergify
Copy link

mergify bot commented Aug 14, 2021

This pull request is now in conflict. Could you fix it @nitrocode? 🙏

@nitrocode
Copy link
Member Author

/test all

main.tf Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ALB target group name is limited to 32 characters
4 participants