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

Infrastructure release: 1.5.3 #1921

Merged
merged 1 commit into from
Sep 26, 2024
Merged

Infrastructure release: 1.5.3 #1921

merged 1 commit into from
Sep 26, 2024

Conversation

patheard
Copy link
Member

@patheard patheard commented Sep 26, 2024

Summary

Block comment POST requests at the WAF firewall and migrate to latest RDS module.

Related

Copy link

Production: database

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

Plan: 0 to add, 2 to change, 0 to destroy
Show summary
CHANGE NAME
update module.rds_cluster.aws_security_group_rule.rds_egress
module.rds_cluster.aws_security_group_rule.rds_ingress
Show plan
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.rds_cluster.aws_cloudwatch_log_group.proxy has moved to module.rds_cluster.aws_cloudwatch_log_group.proxy[0]
    resource "aws_cloudwatch_log_group" "proxy" {
        id                = "/aws/rds/proxy/wordpress-proxy"
        name              = "/aws/rds/proxy/wordpress-proxy"
        tags              = {
            "CostCentre" = "PlatformGCArticles"
            "Name"       = "wordpress_proxy_logs"
            "Terraform"  = "true"
        }
        # (7 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_db_proxy.proxy has moved to module.rds_cluster.aws_db_proxy.proxy[0]
    resource "aws_db_proxy" "proxy" {
        id                     = "wordpress-proxy"
        name                   = "wordpress-proxy"
        tags                   = {
            "CostCentre" = "PlatformGCArticles"
            "Name"       = "wordpress-rds-proxy"
            "Terraform"  = "true"
        }
        # (10 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.rds_cluster.aws_db_proxy_default_target_group.this has moved to module.rds_cluster.aws_db_proxy_default_target_group.this[0]
    resource "aws_db_proxy_default_target_group" "this" {
        id            = "wordpress-proxy"
        name          = "default"
        # (2 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.rds_cluster.aws_db_proxy_target.target has moved to module.rds_cluster.aws_db_proxy_target.target[0]
    resource "aws_db_proxy_target" "target" {
        id                    = "wordpress-proxy/default/TRACKED_CLUSTER/wordpress-cluster"
        # (9 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_iam_policy.read_connection_string has moved to module.rds_cluster.aws_iam_policy.read_connection_string[0]
    resource "aws_iam_policy" "read_connection_string" {
        id               = "arn:aws:iam::472286471787:policy/wordpressReadConnectionString"
        name             = "wordpressReadConnectionString"
        tags             = {
            "CostCentre" = "PlatformGCArticles"
            "Terraform"  = "true"
        }
        # (8 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_iam_role.rds_proxy has moved to module.rds_cluster.aws_iam_role.rds_proxy[0]
    resource "aws_iam_role" "rds_proxy" {
        id                    = "wordpress_rds_proxy"
        name                  = "wordpress_rds_proxy"
        tags                  = {
            "CostCentre" = "PlatformGCArticles"
            "Terraform"  = "true"
        }
        # (12 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.rds_cluster.aws_iam_role_policy_attachment.read_connection_string has moved to module.rds_cluster.aws_iam_role_policy_attachment.read_connection_string[0]
    resource "aws_iam_role_policy_attachment" "read_connection_string" {
        id         = "wordpress_rds_proxy-20211214180918326900000001"
        # (2 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_secretsmanager_secret.connection_string has moved to module.rds_cluster.aws_secretsmanager_secret.connection_string[0]
    resource "aws_secretsmanager_secret" "connection_string" {
        id                             = "arn:aws:secretsmanager:ca-central-1:472286471787:secret:wordpress-rez99n-qx5xQP"
        name                           = "wordpress-rez99n"
        tags                           = {
            "CostCentre" = "PlatformGCArticles"
            "Terraform"  = "true"
        }
        # (8 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_secretsmanager_secret.proxy_connection_string has moved to module.rds_cluster.aws_secretsmanager_secret.proxy_connection_string[0]
    resource "aws_secretsmanager_secret" "proxy_connection_string" {
        id                             = "arn:aws:secretsmanager:ca-central-1:472286471787:secret:wordpress-rez99n-proxy-connection-string-buPs3O"
        name                           = "wordpress-rez99n-proxy-connection-string"
        tags                           = {
            "CostCentre" = "PlatformGCArticles"
            "Terraform"  = "true"
        }
        # (8 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_secretsmanager_secret_version.connection_string has moved to module.rds_cluster.aws_secretsmanager_secret_version.connection_string[0]
    resource "aws_secretsmanager_secret_version" "connection_string" {
        id             = "arn:aws:secretsmanager:ca-central-1:472286471787:secret:wordpress-rez99n-qx5xQP|6539D717-9603-44A9-86B7-28A8F4CF602C"
        # (6 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_secretsmanager_secret_version.proxy_connection_string has moved to module.rds_cluster.aws_secretsmanager_secret_version.proxy_connection_string[0]
    resource "aws_secretsmanager_secret_version" "proxy_connection_string" {
        id             = "arn:aws:secretsmanager:ca-central-1:472286471787:secret:wordpress-rez99n-proxy-connection-string-buPs3O|terraform-20240507022340560800000002"
        # (6 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_security_group.rds_proxy has moved to module.rds_cluster.aws_security_group.rds
    resource "aws_security_group" "rds" {
        id                     = "sg-03f4f613cd728faf0"
        name                   = "wordpress_rds_proxy_sg"
        tags                   = {
            "CostCentre" = "PlatformGCArticles"
            "Name"       = "wordpress_rds_proxy_sg"
            "Terraform"  = "true"
        }
        # (9 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_security_group_rule.rds_egress will be updated in-place
  # (moved from module.rds_cluster.aws_security_group_rule.rds_proxy_egress)
  ~ resource "aws_security_group_rule" "rds_egress" {
      ~ description            = "Proxy egress from the database" -> "Egress from the database"
        id                     = "sgrule-2984853822"
        # (10 unchanged attributes hidden)
    }

  # module.rds_cluster.aws_security_group_rule.rds_ingress will be updated in-place
  # (moved from module.rds_cluster.aws_security_group_rule.rds_proxy_ingress)
  ~ resource "aws_security_group_rule" "rds_ingress" {
      ~ description            = "Proxy ingress to the database" -> "Ingress to the database"
        id                     = "sgrule-542280441"
        # (10 unchanged attributes hidden)
    }

Plan: 0 to add, 2 to change, 0 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_rds_cluster_parameter_group.enable_audit_logging_v8"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.database_host"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.database_name"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.database_password"]
WARN - plan.json - main - Missing Common Tags: ["aws_secretsmanager_secret.database_username"]

24 tests, 19 passed, 5 warnings, 0 failures, 0 exceptions

Copy link

Production: load-balancer

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

Plan: 0 to add, 2 to change, 0 to destroy
Show summary
CHANGE NAME
update aws_s3_bucket.cloudfront_logs
aws_wafv2_web_acl.wordpress_waf
Show plan
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_s3_bucket.cloudfront_logs will be updated in-place
  ~ resource "aws_s3_bucket" "cloudfront_logs" {
        id                          = "wordpress-fargate-production-cloudfront-logs"
        tags                        = {}
        # (14 unchanged attributes hidden)

      ~ lifecycle_rule {
            id                                     = "tf-s3-lifecycle-20211214191202112600000003"
            tags                                   = {}
            # (3 unchanged attributes hidden)

          ~ expiration {
              ~ expired_object_delete_marker = false -> true
                # (2 unchanged attributes hidden)
            }

            # (1 unchanged block hidden)
        }

        # (3 unchanged blocks hidden)
    }

  # aws_wafv2_web_acl.wordpress_waf will be updated in-place
  ~ resource "aws_wafv2_web_acl" "wordpress_waf" {
        id                          = "2e8635c1-e246-402d-95b3-5aab34b0325f"
        name                        = "wordpress_waf"
        tags                        = {
            "CostCentre" = "PlatformGCArticles"
        }
        # (9 unchanged attributes hidden)

      - rule {
          - name     = "WordpressRateLimit" -> null
          - priority = 101 -> null

          - action {
              - block {
                  - custom_response {
                      - response_code            = 429 -> null
                        # (1 unchanged attribute hidden)

                      - response_header {
                          - name  = "waf-block" -> null
                          - value = "RateLimit" -> null
                        }
                    }
                }
            }

          - statement {
              - rate_based_statement {
                  - aggregate_key_type    = "IP" -> null
                  - evaluation_window_sec = 300 -> null
                  - limit                 = 2000 -> null
                }
            }

          - visibility_config {
              - cloudwatch_metrics_enabled = true -> null
              - metric_name                = "WordpressRateLimit" -> null
              - sampled_requests_enabled   = true -> null
            }
        }
      - rule {
          - name     = "AWSManagedRulesAmazonIpReputationList" -> null
          - priority = 10 -> null

          - override_action {
              - none {}
            }

          - statement {
              - managed_rule_group_statement {
                  - name        = "AWSManagedRulesAmazonIpReputationList" -> null
                  - vendor_name = "AWS" -> null
                    # (1 unchanged attribute hidden)
                }
            }

          - visibility_config {
              - cloudwatch_metrics_enabled = true -> null
              - metric_name                = "AWSManagedRulesAmazonIpReputationList" -> null
              - sampled_requests_enabled   = true -> null
            }
        }
      - rule {
          - name     = "AWSManagedRulesKnownBadInputsRuleSet" -> null
          - priority = 2 -> null

          - override_action {
              - none {}
            }

          - statement {
              - managed_rule_group_statement {
                  - name        = "AWSManagedRulesKnownBadInputsRuleSet" -> null
                  - vendor_name = "AWS" -> null
                    # (1 unchanged attribute hidden)
                }
            }

          - visibility_config {
              - cloudwatch_metrics_enabled = true -> null
              - metric_name                = "AWSManagedRulesKnownBadInputsRuleSet" -> null
              - sampled_requests_enabled   = true -> null
            }
        }
      - rule {
          - name     = "AWSManagedRulesPHPRuleSet" -> null
          - priority = 8 -> null

          - override_action {
              - none {}
            }

          - statement {
              - managed_rule_group_statement {
                  - name        = "AWSManagedRulesPHPRuleSet" -> null
                  - vendor_name = "AWS" -> null
                    # (1 unchanged attribute hidden)
                }
            }

          - visibility_config {
              - cloudwatch_metrics_enabled = true -> null
              - metric_name                = "AWSManagedRulesPHPRuleSet" -> null
              - sampled_requests_enabled   = true -> null
            }
        }
      - rule {
          - name     = "AWSManagedRulesWordPressRuleSet" -> null
          - priority = 9 -> null

          - override_action {
              - none {}
            }

          - statement {
              - managed_rule_group_statement {
                  - name        = "AWSManagedRulesWordPressRuleSet" -> null
                  - vendor_name = "AWS" -> null
                    # (1 unchanged attribute hidden)
                }
            }

          - visibility_config {
              - cloudwatch_metrics_enabled = true -> null
              - metric_name                = "AWSManagedRulesWordPressRuleSet" -> null
              - sampled_requests_enabled   = true -> null
            }
        }
      + rule {
          + name     = "WordpressRateLimit"
          + priority = 101

          + action {
              + block {
                  + custom_response {
                      + response_code = 429

                      + response_header {
                          + name  = "waf-block"
                          + value = "RateLimit"
                        }
                    }
                }
            }

          + statement {
              + rate_based_statement {
                  + aggregate_key_type    = "IP"
                  + evaluation_window_sec = 300
                  + limit                 = 2000
                }
            }

          + visibility_config {
              + cloudwatch_metrics_enabled = true
              + metric_name                = "WordpressRateLimit"
              + sampled_requests_enabled   = true
            }
        }
      + rule {
          + name     = "BlockComments"
          + priority = 13

          + action {
              + block {
                }
            }

          + statement {
              + and_statement {
                  + statement {
                      + byte_match_statement {
                          + positional_constraint = "CONTAINS"
                          + search_string         = "wp-comments-post.php"

                          + field_to_match {
                              + uri_path {}
                            }

                          + text_transformation {
                              + priority = 0
                              + type     = "LOWERCASE"
                            }
                        }
                    }
                  + statement {
                      + byte_match_statement {
                          + positional_constraint = "EXACTLY"
                          + search_string         = "post"

                          + field_to_match {
                              + method {}
                            }

                          + text_transformation {
                              + priority = 0
                              + type     = "LOWERCASE"
                            }
                        }
                    }
                }
            }

          + visibility_config {
              + cloudwatch_metrics_enabled = true
              + metric_name                = "BlockComments"
              + sampled_requests_enabled   = true
            }
        }
      + rule {
          + name     = "AWSManagedRulesAmazonIpReputationList"
          + priority = 10

          + override_action {
              + none {}
            }

          + statement {
              + managed_rule_group_statement {
                  + name        = "AWSManagedRulesAmazonIpReputationList"
                  + vendor_name = "AWS"
                }
            }

          + visibility_config {
              + cloudwatch_metrics_enabled = true
              + metric_name                = "AWSManagedRulesAmazonIpReputationList"
              + sampled_requests_enabled   = true
            }
        }
      + rule {
          + name     = "AWSManagedRulesKnownBadInputsRuleSet"
          + priority = 2

          + override_action {
              + none {}
            }

          + statement {
              + managed_rule_group_statement {
                  + name        = "AWSManagedRulesKnownBadInputsRuleSet"
                  + vendor_name = "AWS"
                }
            }

          + visibility_config {
              + cloudwatch_metrics_enabled = true
              + metric_name                = "AWSManagedRulesKnownBadInputsRuleSet"
              + sampled_requests_enabled   = true
            }
        }
      + rule {
          + name     = "AWSManagedRulesPHPRuleSet"
          + priority = 8

          + override_action {
              + none {}
            }

          + statement {
              + managed_rule_group_statement {
                  + name        = "AWSManagedRulesPHPRuleSet"
                  + vendor_name = "AWS"
                }
            }

          + visibility_config {
              + cloudwatch_metrics_enabled = true
              + metric_name                = "AWSManagedRulesPHPRuleSet"
              + sampled_requests_enabled   = true
            }
        }
      + rule {
          + name     = "AWSManagedRulesWordPressRuleSet"
          + priority = 9

          + override_action {
              + none {}
            }

          + statement {
              + managed_rule_group_statement {
                  + name        = "AWSManagedRulesWordPressRuleSet"
                  + vendor_name = "AWS"
                }
            }

          + visibility_config {
              + cloudwatch_metrics_enabled = true
              + metric_name                = "AWSManagedRulesWordPressRuleSet"
              + sampled_requests_enabled   = true
            }
        }

        # (10 unchanged blocks hidden)
    }

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

Warning: Argument is deprecated

  with aws_s3_bucket.cloudfront_logs,
  on s3.tf line 4, in resource "aws_s3_bucket" "cloudfront_logs":
   4: resource "aws_s3_bucket" "cloudfront_logs" {

Use the aws_s3_bucket_lifecycle_configuration resource instead

(and 5 more similar warnings elsewhere)

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

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_acm_certificate.wordpress"]
WARN - plan.json - main - Missing Common Tags: ["aws_acm_certificate.wordpress_cloudfront"]
WARN - plan.json - main - Missing Common Tags: ["aws_acm_certificate.wordpress_new[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_acm_certificate.wordpress_new_cloudfront[0]"]
WARN - plan.json - main - Missing Common Tags: ["aws_cloudfront_distribution.wordpress"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.cache_buster"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_policy.firehose_waf_logs"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_role.firehose_waf_logs"]
WARN - plan.json - main - Missing Common Tags: ["aws_iam_user.cache_buster"]
WARN - plan.json - main - Missing Common Tags: ["aws_lb.wordpress"]
WARN - plan.json - main - Missing Common Tags: ["aws_lb_listener.wordpress"]
WARN - plan.json - main - Missing Common Tags: ["aws_lb_target_group.wordpress"]
WARN - plan.json - main - Missing Common Tags: ["aws_s3_bucket.cloudfront_logs"]
WARN - plan.json - main - Missing Common Tags: ["aws_wafv2_web_acl.wordpress_waf"]
WARN - plan.json - main - Missing Common Tags: ["aws_wafv2_web_acl.wordpress_waf_alb"]

34 tests, 19 passed, 15 warnings, 0 failures, 0 exceptions

@patheard patheard self-assigned this Sep 26, 2024
@patheard patheard requested a review from a team September 26, 2024 18:04
@patheard patheard merged commit 65df102 into main Sep 26, 2024
16 checks passed
@patheard patheard deleted the infrastructure/1.5.3 branch September 26, 2024 18:13
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