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

nlb-targetgroups #443

Merged
merged 9 commits into from
Sep 11, 2023
Merged

nlb-targetgroups #443

merged 9 commits into from
Sep 11, 2023

Conversation

bcarranza
Copy link
Collaborator

@bcarranza bcarranza commented Sep 5, 2023

What

  • Modify NLB terraform due it wasn't complete .
  • Add target groups feature to this terraform
  • Dynamic to add atachments to target groups.

Evidence of proof

Where we are using this?
https://github.com/exact-payments/gruntwork-infrastructure-live/pull/1879

terragrunt apply
Acquiring state lock. This may take a few moments...
aws_lb.nlb: Refreshing state... [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:loadbalancer/net/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28]
aws_lb_target_group.tg: Refreshing state... [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:targetgroup/dp-dev-sftp-ptm-tg/b989b1de3d7154dd]
aws_lb_target_group_attachment.tg-attachment-1: Refreshing state... [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:targetgroup/dp-dev-sftp-ptm-tg/b989b1de3d7154dd-20230906010231447700000003]
aws_lb_target_group_attachment.tg-attachment-2: Refreshing state... [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:targetgroup/dp-dev-sftp-ptm-tg/b989b1de3d7154dd-20230906010231368100000002]
aws_lb_target_group_attachment.tg-attachment-3: Refreshing state... [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:targetgroup/dp-dev-sftp-ptm-tg/b989b1de3d7154dd-20230906010231032100000001]

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:

  # aws_lb.nlb has changed
  ~ resource "aws_lb" "nlb" {
      + arn                              = "arn:aws:elasticloadbalancing:us-west-2:042093043970:loadbalancer/net/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28"
      + dns_name                         = "dp-dev-sftp-ptm-nlb-b6d1b6a6f6462c28.elb.us-west-2.amazonaws.com"
        id                               = "arn:aws:elasticloadbalancing:us-west-2:042093043970:loadbalancer/net/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28"
        name                             = "dp-dev-sftp-ptm-nlb"
        tags                             = {
            "ops_env"              = "dp-dev"
            "ops_managed_by"       = "terraform"
            "ops_owners"           = "devops"
            "ops_source_repo"      = "gruntwork-infrastructure-live"
            "ops_source_repo_path" = "dp-dev/us-west-2/ptmt/10-nlb-transfer-family/01-nlb"
        }
        # (7 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }


Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.

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

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # aws_lb.nlb is tainted, so must be replaced
-/+ resource "aws_lb" "nlb" {
      ~ arn                              = "arn:aws:elasticloadbalancing:us-west-2:042093043970:loadbalancer/net/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28" -> (known after apply)
      ~ arn_suffix                       = "net/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28" -> (known after apply)
      ~ dns_name                         = "dp-dev-sftp-ptm-nlb-b6d1b6a6f6462c28.elb.us-west-2.amazonaws.com" -> (known after apply)
      ~ id                               = "arn:aws:elasticloadbalancing:us-west-2:042093043970:loadbalancer/net/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28" -> (known after apply)
      ~ ip_address_type                  = "ipv4" -> (known after apply)
        name                             = "dp-dev-sftp-ptm-nlb"
        tags                             = {
            "ops_env"              = "dp-dev"
            "ops_managed_by"       = "terraform"
            "ops_owners"           = "devops"
            "ops_source_repo"      = "gruntwork-infrastructure-live"
            "ops_source_repo_path" = "dp-dev/us-west-2/ptmt/10-nlb-transfer-family/01-nlb"
        }
      ~ vpc_id                           = "vpc-037ca435b8ed4c480" -> (known after apply)
      ~ zone_id                          = "Z18D5FSROUN65G" -> (known after apply)
        # (7 unchanged attributes hidden)

      - access_logs {
          - enabled = false -> null
        }

      - subnet_mapping {
          - subnet_id = "subnet-0645e9da32ae0cd3b" -> null
        }
      - subnet_mapping {
          - subnet_id = "subnet-0c9169e5c52942664" -> null
        }
      - subnet_mapping {
          - subnet_id = "subnet-0d7d01efa027fdb7a" -> null
        }
      - subnet_mapping {
          - subnet_id = "subnet-0f36ee5e0ccffe90c" -> null
        }
      + subnet_mapping {
          + allocation_id        = (known after apply)
          + ipv6_address         = (known after apply)
          + outpost_id           = (known after apply)
          + private_ipv4_address = (known after apply)
          + subnet_id            = (known after apply)
        }
    }

  # aws_lb_listener.listener will be created
  + resource "aws_lb_listener" "listener" {
      + arn               = (known after apply)
      + id                = (known after apply)
      + load_balancer_arn = (known after apply)
      + port              = 22
      + protocol          = "TCP"
      + ssl_policy        = (known after apply)
      + tags_all          = (known after apply)

      + default_action {
          + order            = (known after apply)
          + target_group_arn = "arn:aws:elasticloadbalancing:us-west-2:042093043970:targetgroup/dp-dev-sftp-ptm-tg/b989b1de3d7154dd"
          + type             = "forward"
        }
    }

Plan: 2 to add, 0 to change, 1 to destroy.

Changes to Outputs:
  ~ load_balancer_external_dns = "sftp-ptm-nlb-fbec63df63ed2d59.elb.us-west-2.amazonaws.com" -> (known after apply)

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_lb.nlb: Destroying... [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:loadbalancer/net/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28]
aws_lb.nlb: Still destroying... [id=arn:aws:elasticloadbalancing:us-west-2:...t/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28, 10s elapsed]
aws_lb.nlb: Still destroying... [id=arn:aws:elasticloadbalancing:us-west-2:...t/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28, 20s elapsed]
aws_lb.nlb: Still destroying... [id=arn:aws:elasticloadbalancing:us-west-2:...t/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28, 30s elapsed]
aws_lb.nlb: Still destroying... [id=arn:aws:elasticloadbalancing:us-west-2:...t/dp-dev-sftp-ptm-nlb/b6d1b6a6f6462c28, 40s elapsed]
aws_lb.nlb: Destruction complete after 50s
aws_lb.nlb: Creating...
aws_lb.nlb: Still creating... [10s elapsed]
aws_lb.nlb: Still creating... [20s elapsed]
aws_lb.nlb: Still creating... [30s elapsed]
aws_lb.nlb: Still creating... [40s elapsed]
aws_lb.nlb: Still creating... [50s elapsed]
aws_lb.nlb: Still creating... [1m0s elapsed]
aws_lb.nlb: Still creating... [1m10s elapsed]
aws_lb.nlb: Still creating... [1m20s elapsed]
aws_lb.nlb: Still creating... [1m30s elapsed]
aws_lb.nlb: Still creating... [1m40s elapsed]
aws_lb.nlb: Still creating... [1m50s elapsed]
aws_lb.nlb: Still creating... [2m0s elapsed]
aws_lb.nlb: Still creating... [2m10s elapsed]
aws_lb.nlb: Still creating... [2m20s elapsed]
aws_lb.nlb: Still creating... [2m30s elapsed]
aws_lb.nlb: Still creating... [2m40s elapsed]
aws_lb.nlb: Still creating... [2m50s elapsed]
aws_lb.nlb: Creation complete after 2m54s [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:loadbalancer/net/dp-dev-sftp-ptm-nlb/d6cb9176be5f3c3f]
aws_lb_listener.listener: Creating...
aws_lb_listener.listener: Creation complete after 1s [id=arn:aws:elasticloadbalancing:us-west-2:042093043970:listener/net/dp-dev-sftp-ptm-nlb/d6cb9176be5f3c3f/31af2ba4b94608b6]
Releasing state lock. This may take a few moments...

Apply complete! Resources: 2 added, 0 changed, 1 destroyed.

Outputs:
Screenshot 2023-09-05 at 21 27 36 Screenshot 2023-09-05 at 21 28 12 Screenshot 2023-09-05 at 21 28 26 Screenshot 2023-09-05 at 21 30 03

@sekka1 sekka1 merged commit 16820d2 into main Sep 11, 2023
@sekka1 sekka1 deleted the nlb-targetgroups branch September 11, 2023 21:47
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