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

fix: Add egress rule from lambda to db #914

Merged
merged 3 commits into from
Dec 4, 2024

Conversation

bryan-robitaille
Copy link
Contributor

Summary | Résumé

Adds missing egress rule from lambda to RDS

@bryan-robitaille bryan-robitaille enabled auto-merge (squash) December 4, 2024 13:10
Copy link

github-actions bot commented Dec 4, 2024

⚠ Terrform update available

Terraform: 1.10.1 (using 1.9.8)
Terragrunt: 0.69.7 (using 0.69.2)

1 similar comment
Copy link

github-actions bot commented Dec 4, 2024

⚠ Terrform update available

Terraform: 1.10.1 (using 1.9.8)
Terragrunt: 0.69.7 (using 0.69.2)

Copy link

github-actions bot commented Dec 4, 2024

Staging: network

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

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

Plan: 6 to add, 0 to change, 4 to destroy
Show summary
CHANGE NAME
add aws_vpc_security_group_egress_rule.internet_lambda
aws_vpc_security_group_egress_rule.rds_lambda
aws_vpc_security_group_egress_rule.redis_lambda
aws_vpc_security_group_ingress_rule.privatelink_lambda
aws_vpc_security_group_ingress_rule.rds_lambda
aws_vpc_security_group_ingress_rule.redis_lambda
delete aws_vpc_security_group_egress_rule.internet
aws_vpc_security_group_ingress_rule.privatelink
aws_vpc_security_group_ingress_rule.rds
aws_vpc_security_group_ingress_rule.redis
Show plan
Resource actions are indicated with the following symbols:
  + create
  - destroy

Terraform will perform the following actions:

  # aws_vpc_security_group_egress_rule.internet will be destroyed
  # (because aws_vpc_security_group_egress_rule.internet is not in configuration)
  - resource "aws_vpc_security_group_egress_rule" "internet" {
      - arn                    = "arn:aws:ec2:ca-central-1:687401027353:security-group-rule/sgr-07952d230dd6d3751" -> null
      - cidr_ipv4              = "0.0.0.0/0" -> null
      - description            = "Egress to the internet from Nagware Lambda function" -> null
      - from_port              = 443 -> null
      - id                     = "sgr-07952d230dd6d3751" -> null
      - ip_protocol            = "tcp" -> null
      - security_group_id      = "sg-06651d69cd4d3c50f" -> null
      - security_group_rule_id = "sgr-07952d230dd6d3751" -> null
      - tags_all               = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
      - to_port                = 443 -> null
    }

  # aws_vpc_security_group_egress_rule.internet_lambda will be created
  + resource "aws_vpc_security_group_egress_rule" "internet_lambda" {
      + arn                    = (known after apply)
      + cidr_ipv4              = "0.0.0.0/0"
      + description            = "Egress to the internet from Nagware Lambda function"
      + from_port              = 443
      + id                     = (known after apply)
      + ip_protocol            = "tcp"
      + security_group_id      = "sg-06651d69cd4d3c50f"
      + security_group_rule_id = (known after apply)
      + tags_all               = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + to_port                = 443
    }

  # aws_vpc_security_group_egress_rule.rds_lambda will be created
  + resource "aws_vpc_security_group_egress_rule" "rds_lambda" {
      + arn                          = (known after apply)
      + description                  = "Egress from lambda to database"
      + from_port                    = 5432
      + id                           = (known after apply)
      + ip_protocol                  = "tcp"
      + referenced_security_group_id = "sg-0b80bb714d886b8ff"
      + security_group_id            = "sg-06651d69cd4d3c50f"
      + security_group_rule_id       = (known after apply)
      + tags_all                     = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + to_port                      = 5432
    }

  # aws_vpc_security_group_egress_rule.redis_lambda will be created
  + resource "aws_vpc_security_group_egress_rule" "redis_lambda" {
      + arn                          = (known after apply)
      + description                  = "Egress from lambda to Redis"
      + from_port                    = 6379
      + id                           = (known after apply)
      + ip_protocol                  = "tcp"
      + referenced_security_group_id = "sg-092fddfbbac0e15aa"
      + security_group_id            = "sg-06651d69cd4d3c50f"
      + security_group_rule_id       = (known after apply)
      + tags_all                     = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + to_port                      = 6379
    }

  # aws_vpc_security_group_ingress_rule.privatelink will be destroyed
  # (because aws_vpc_security_group_ingress_rule.privatelink is not in configuration)
  - resource "aws_vpc_security_group_ingress_rule" "privatelink" {
      - arn                          = "arn:aws:ec2:ca-central-1:687401027353:security-group-rule/sgr-0fb0ef2cefbdc4bbb" -> null
      - description                  = "Security group rule for Lambda function ingress" -> null
      - from_port                    = 443 -> null
      - id                           = "sgr-0fb0ef2cefbdc4bbb" -> null
      - ip_protocol                  = "tcp" -> null
      - referenced_security_group_id = "sg-06651d69cd4d3c50f" -> null
      - security_group_id            = "sg-089a83b7d81dff031" -> null
      - security_group_rule_id       = "sgr-0fb0ef2cefbdc4bbb" -> null
      - tags_all                     = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
      - to_port                      = 443 -> null
    }

  # aws_vpc_security_group_ingress_rule.privatelink_lambda will be created
  + resource "aws_vpc_security_group_ingress_rule" "privatelink_lambda" {
      + arn                          = (known after apply)
      + description                  = "Security group rule for Lambda function ingress"
      + from_port                    = 443
      + id                           = (known after apply)
      + ip_protocol                  = "tcp"
      + referenced_security_group_id = "sg-06651d69cd4d3c50f"
      + security_group_id            = "sg-089a83b7d81dff031"
      + security_group_rule_id       = (known after apply)
      + tags_all                     = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + to_port                      = 443
    }

  # aws_vpc_security_group_ingress_rule.rds will be destroyed
  # (because aws_vpc_security_group_ingress_rule.rds is not in configuration)
  - resource "aws_vpc_security_group_ingress_rule" "rds" {
      - arn                          = "arn:aws:ec2:ca-central-1:687401027353:security-group-rule/sgr-01e93a0e97cbe16ea" -> null
      - description                  = "Ingress to database from lambda" -> null
      - from_port                    = 5432 -> null
      - id                           = "sgr-01e93a0e97cbe16ea" -> null
      - ip_protocol                  = "tcp" -> null
      - referenced_security_group_id = "sg-06651d69cd4d3c50f" -> null
      - security_group_id            = "sg-0b80bb714d886b8ff" -> null
      - security_group_rule_id       = "sgr-01e93a0e97cbe16ea" -> null
      - tags_all                     = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
      - to_port                      = 5432 -> null
    }

  # aws_vpc_security_group_ingress_rule.rds_lambda will be created
  + resource "aws_vpc_security_group_ingress_rule" "rds_lambda" {
      + arn                          = (known after apply)
      + description                  = "Ingress to database from lambda"
      + from_port                    = 5432
      + id                           = (known after apply)
      + ip_protocol                  = "tcp"
      + referenced_security_group_id = "sg-06651d69cd4d3c50f"
      + security_group_id            = "sg-0b80bb714d886b8ff"
      + security_group_rule_id       = (known after apply)
      + tags_all                     = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + to_port                      = 5432
    }

  # aws_vpc_security_group_ingress_rule.redis will be destroyed
  # (because aws_vpc_security_group_ingress_rule.redis is not in configuration)
  - resource "aws_vpc_security_group_ingress_rule" "redis" {
      - arn                          = "arn:aws:ec2:ca-central-1:687401027353:security-group-rule/sgr-056484e09376a647e" -> null
      - description                  = "Ingress to Redis from lambda" -> null
      - from_port                    = 6379 -> null
      - id                           = "sgr-056484e09376a647e" -> null
      - ip_protocol                  = "tcp" -> null
      - referenced_security_group_id = "sg-06651d69cd4d3c50f" -> null
      - security_group_id            = "sg-092fddfbbac0e15aa" -> null
      - security_group_rule_id       = "sgr-056484e09376a647e" -> null
      - tags_all                     = {
          - "CostCentre" = "forms-platform-staging"
          - "Terraform"  = "true"
        } -> null
      - to_port                      = 6379 -> null
    }

  # aws_vpc_security_group_ingress_rule.redis_lambda will be created
  + resource "aws_vpc_security_group_ingress_rule" "redis_lambda" {
      + arn                          = (known after apply)
      + description                  = "Ingress to Redis from lambda"
      + from_port                    = 6379
      + id                           = (known after apply)
      + ip_protocol                  = "tcp"
      + referenced_security_group_id = "sg-06651d69cd4d3c50f"
      + security_group_id            = "sg-092fddfbbac0e15aa"
      + security_group_rule_id       = (known after apply)
      + tags_all                     = {
          + "CostCentre" = "forms-platform-staging"
          + "Terraform"  = "true"
        }
      + to_port                      = 6379
    }

Plan: 6 to add, 0 to change, 4 to destroy.

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

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_default_network_acl.forms"]
WARN - plan.json - main - Missing Common Tags: ["aws_default_security_group.default"]
WARN - plan.json - main - Missing Common Tags: ["aws_eip.forms_natgw[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_eip.forms_natgw[1]"]
WARN - plan.json - main - Missing Common Tags: ["aws_eip.forms_natgw[2]"]
WARN - plan.json - main - Missing Common Tags: ["aws_flow_log.vpc_flow_logs[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_internet_gateway.forms"]
WARN - plan.json - main - Missing Common Tags: ["aws_nat_gateway.forms[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_nat_gateway.forms[1]"]
WARN - plan.json - main - Missing Common Tags: ["aws_nat_gateway.forms[2]"]
WARN - plan.json - main - Missing Common Tags: ["aws_route_table.forms_private_subnet[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_route_table.forms_private_subnet[1]"]
WARN - plan.json - main - Missing Common Tags: ["aws_route_table.forms_private_subnet[2]"]
WARN - plan.json - main - Missing Common Tags: ["aws_route_table.forms_public_subnet"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.api_ecs"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.connector_db"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.forms"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.forms_database"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.forms_egress"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.forms_load_balancer"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.forms_redis"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.idp_db"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.idp_ecs"]
WARN - plan.json - main - Missing Common Tags: ["aws_security_group.idp_lb"]
WARN - plan.json - main - Missing Common Tags:...

@bryan-robitaille bryan-robitaille merged commit de7d49d into main Dec 4, 2024
20 of 21 checks passed
@bryan-robitaille bryan-robitaille deleted the fix/rds_lambda_egress_rule branch December 4, 2024 13:11
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