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

feat: add HTTP2 IdP target group #762

Merged
merged 5 commits into from
Aug 6, 2024
Merged

Conversation

patheard
Copy link
Member

@patheard patheard commented Aug 5, 2024

Summary

Update the IdP load balancer to include an HTTP1 and HTTP2 target group. An ALB listener rule has also been added to send all REST API requests to the HTTP1 target group, while the HTTP2 target group is responsible for forwarding all other traffic.

The ECS service has also been updated to register both target groups.

Related

Update the IdP load balancer to include an HTTP1 and HTTP2 target
group.  An ALB listener rule has also been added to send all REST
API requests to the HTTP1 target group, while the HTTP2 target
group is responsible for forwarding all other traffic.

The ECS service has also been updated to register both target
groups.
Copy link

github-actions bot commented Aug 6, 2024

⚠ Terrform update available

Terraform: 1.9.3 (using 1.9.2)
Terragrunt: 0.66.2 (using 0.63.2)

Copy link

github-actions bot commented Aug 6, 2024

Staging: idp

✅   Terraform Init: success
✅   Terraform Validate: success
✅   Terraform Format: success
✅   Terraform Plan: success
✅   Conftest: success

⚠️   Warning: resources will be destroyed by this change!

Plan: 4 to add, 2 to change, 2 to destroy
Show summary
CHANGE NAME
update aws_lb_listener.idp
module.idp_ecs.aws_ecs_service.this
recreate random_string.idp_alb_tg_suffix
add aws_alb_listener_rule.idp_protocol_version
aws_lb_target_group.idp["HTTP1"]
aws_lb_target_group.idp["HTTP2"]
delete aws_lb_target_group.idp
Show plan
Resource actions are indicated with the following symbols:
  + create
  ~ update in-place
  - destroy
+/- create replacement and then destroy

Terraform will perform the following actions:

  # aws_alb_listener_rule.idp_protocol_version will be created
  + resource "aws_alb_listener_rule" "idp_protocol_version" {
      + arn          = (known after apply)
      + id           = (known after apply)
      + listener_arn = "arn:aws:elasticloadbalancing:ca-central-1:687401027353:listener/app/idp/9bb4fc6f33420bc4/ab056b245c94d5c3"
      + priority     = 100
      + tags_all     = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }

      + action {
          + order            = (known after apply)
          + target_group_arn = (known after apply)
          + type             = "forward"
        }

      + condition {
          + path_pattern {
              + values = [
                  + "/*/v?/*",
                ]
            }
        }
    }

  # aws_lb_listener.idp will be updated in-place
  ~ resource "aws_lb_listener" "idp" {
        id                = "arn:aws:elasticloadbalancing:ca-central-1:687401027353:listener/app/idp/9bb4fc6f33420bc4/ab056b245c94d5c3"
        tags              = {
            "CostCentre" = "forms-platform-staging"
            "Terraform"  = "true"
        }
        # (7 unchanged attributes hidden)

      ~ default_action {
          ~ target_group_arn = "arn:aws:elasticloadbalancing:ca-central-1:687401027353:targetgroup/idp-tg-725/0e3b13f26a36f391" -> (known after apply)
            # (2 unchanged attributes hidden)
        }

        # (1 unchanged block hidden)
    }

  # aws_lb_target_group.idp will be destroyed
  # (because resource uses count or for_each)
  - resource "aws_lb_target_group" "idp" {
      - arn                                = "arn:aws:elasticloadbalancing:ca-central-1:687401027353:targetgroup/idp-tg-725/0e3b13f26a36f391" -> null
      - arn_suffix                         = "targetgroup/idp-tg-725/0e3b13f26a36f391" -> null
      - deregistration_delay               = "30" -> null
      - id                                 = "arn:aws:elasticloadbalancing:ca-central-1:687401027353:targetgroup/idp-tg-725/0e3b13f26a36f391" -> null
      - ip_address_type                    = "ipv4" -> null
      - lambda_multi_value_headers_enabled = false -> null
      - load_balancer_arns                 = [
          - "arn:aws:elasticloadbalancing:ca-central-1:687401027353:loadbalancer/app/idp/9bb4fc6f33420bc4",
        ] -> null
      - load_balancing_algorithm_type      = "round_robin" -> null
      - load_balancing_anomaly_mitigation  = "off" -> null
      - load_balancing_cross_zone_enabled  = "use_load_balancer_configuration" -> null
      - name                               = "idp-tg-725" -> null
      - port                               = 8080 -> null
      - protocol                           = "HTTPS" -> null
      - protocol_version                   = "HTTP1" -> null
      - proxy_protocol_v2                  = false -> null
      - slow_start                         = 0 -> null
      - tags                               = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
      - tags_all                           = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
      - target_type                        = "ip" -> null
      - vpc_id                             = "vpc-0ad5b3739860129d0" -> null
        # (1 unchanged attribute hidden)

      - health_check {
          - enabled             = true -> null
          - healthy_threshold   = 3 -> null
          - interval            = 30 -> null
          - matcher             = "200-399" -> null
          - path                = "/debug/healthz" -> null
          - port                = "traffic-port" -> null
          - protocol            = "HTTPS" -> null
          - timeout             = 5 -> null
          - unhealthy_threshold = 3 -> null
        }

      - stickiness {
          - cookie_duration = 86400 -> null
          - enabled         = true -> null
          - type            = "lb_cookie" -> null
            # (1 unchanged attribute hidden)
        }

      - target_failover {}

      - target_group_health {
          - dns_failover {
              - minimum_healthy_targets_count      = "1" -> null
              - minimum_healthy_targets_percentage = "off" -> null
            }
          - unhealthy_state_routing {
              - minimum_healthy_targets_count      = 1 -> null
              - minimum_healthy_targets_percentage = "off" -> null
            }
        }

      - target_health_state {}
    }

  # aws_lb_target_group.idp["HTTP1"] will be created
  + resource "aws_lb_target_group" "idp" {
      + arn                                = (known after apply)
      + arn_suffix                         = (known after apply)
      + connection_termination             = (known after apply)
      + deregistration_delay               = "30"
      + id                                 = (known after apply)
      + ip_address_type                    = (known after apply)
      + lambda_multi_value_headers_enabled = false
      + load_balancer_arns                 = (known after apply)
      + load_balancing_algorithm_type      = (known after apply)
      + load_balancing_anomaly_mitigation  = (known after apply)
      + load_balancing_cross_zone_enabled  = (known after apply)
      + name                               = (known after apply)
      + name_prefix                        = (known after apply)
      + port                               = 8080
      + preserve_client_ip                 = (known after apply)
      + protocol                           = "HTTPS"
      + protocol_version                   = "HTTP1"
      + proxy_protocol_v2                  = false
      + slow_start                         = 0
      + tags                               = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + tags_all                           = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + target_type                        = "ip"
      + vpc_id                             = "vpc-0ad5b3739860129d0"

      + health_check {
          + enabled             = true
          + healthy_threshold   = 3
          + interval            = 30
          + matcher             = "200-399"
          + path                = "/debug/healthz"
          + port                = "traffic-port"
          + protocol            = "HTTPS"
          + timeout             = (known after apply)
          + unhealthy_threshold = 3
        }

      + stickiness {
          + cookie_duration = 86400
          + enabled         = true
          + type            = "lb_cookie"
        }

      + target_failover (known after apply)

      + target_group_health (known after apply)

      + target_health_state (known after apply)
    }

  # aws_lb_target_group.idp["HTTP2"] will be created
  + resource "aws_lb_target_group" "idp" {
      + arn                                = (known after apply)
      + arn_suffix                         = (known after apply)
      + connection_termination             = (known after apply)
      + deregistration_delay               = "30"
      + id                                 = (known after apply)
      + ip_address_type                    = (known after apply)
      + lambda_multi_value_headers_enabled = false
      + load_balancer_arns                 = (known after apply)
      + load_balancing_algorithm_type      = (known after apply)
      + load_balancing_anomaly_mitigation  = (known after apply)
      + load_balancing_cross_zone_enabled  = (known after apply)
      + name                               = (known after apply)
      + name_prefix                        = (known after apply)
      + port                               = 8080
      + preserve_client_ip                 = (known after apply)
      + protocol                           = "HTTPS"
      + protocol_version                   = "HTTP2"
      + proxy_protocol_v2                  = false
      + slow_start                         = 0
      + tags                               = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + tags_all                           = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + target_type                        = "ip"
      + vpc_id                             = "vpc-0ad5b3739860129d0"

      + health_check {
          + enabled             = true
          + healthy_threshold   = 3
          + interval            = 30
          + matcher             = "200-399"
          + path                = "/debug/healthz"
          + port                = "traffic-port"
          + protocol            = "HTTPS"
          + timeout             = (known after apply)
          + unhealthy_threshold = 3
        }

      + stickiness {
          + cookie_duration = 86400
          + enabled         = true
          + type            = "lb_cookie"
        }

      + target_failover (known after apply)

      + target_group_health (known after apply)

      + target_health_state (known after apply)
    }

  # random_string.idp_alb_tg_suffix must be replaced
+/- resource "random_string" "idp_alb_tg_suffix" {
      ~ id          = "725" -> (known after apply)
      ~ keepers     = { # forces replacement
          - "protocol_version"  = "HTTP1" -> null
          + "protocol_versions" = "HTTP1,HTTP2"
            # (2 unchanged elements hidden)
        }
      ~ result      = "725" -> (known after apply)
        # (10 unchanged attributes hidden)
    }

  # module.idp_ecs.aws_ecs_service.this will be updated in-place
  ~ resource "aws_ecs_service" "this" {
      - health_check_grace_period_seconds  = 60 -> null
        id                                 = "arn:aws:ecs:ca-central-1:687401027353:service/idp/zitadel"
        name                               = "zitadel"
        tags                               = {
            "CostCentre" = "forms-platform-staging"
            "Terraform"  = "true"
        }
        # (15 unchanged attributes hidden)

      - load_balancer {
          - container_name   = "zitadel" -> null
          - container_port   = 8080 -> null
          - target_group_arn = "arn:aws:elasticloadbalancing:ca-central-1:687401027353:targetgroup/idp-tg-725/0e3b13f26a36f391" -> null
            # (1 unchanged attribute hidden)
        }
      + load_balancer {
          + container_name   = "zitadel"
          + container_port   = 8080
          + target_group_arn = (known after apply)
            # (1 unchanged attribute hidden)
        }
      + load_balancer {
          + container_name   = "zitadel"
          + container_port   = 8080
          + target_group_arn = (known after apply)
            # (1 unchanged attribute hidden)
        }

        # (3 unchanged blocks hidden)
    }

Plan: 4 to add, 2 to change, 2 to destroy.

Changes to Outputs:
  ~ lb_idp_target_group_arn_suffix    = "targetgroup/idp-tg-725/0e3b13f26a36f391" -> (known after apply)

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: plan.tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "plan.tfplan"
Show Conftest results
WARN - plan.json - main - Missing Common Tags: ["aws_alb_listener_rule.idp_protocol_version"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.idp_send_email"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_user.idp_send_email"]
WARN - plan.json - main - Missing Common Tags: ["aws_shield_protection.idp"]

23 tests, 19 passed, 4 warnings, 0 failures, 0 exceptions

@patheard patheard marked this pull request as ready for review August 6, 2024 15:44
@patheard patheard self-assigned this Aug 6, 2024
@patheard patheard merged commit e49bcb6 into develop Aug 6, 2024
11 checks passed
@patheard patheard deleted the feat/idp-lb-target-groups branch August 6, 2024 17:07
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.

2 participants