Skip to content

feat(ha-hot-hot/aws): VPC flow logs, matching single-vm/unlimited-scale#52

Open
dmchaledev wants to merge 1 commit into
mainfrom
claude/blissful-pascal-wqpwmu
Open

feat(ha-hot-hot/aws): VPC flow logs, matching single-vm/unlimited-scale#52
dmchaledev wants to merge 1 commit into
mainfrom
claude/blissful-pascal-wqpwmu

Conversation

@dmchaledev

Copy link
Copy Markdown
Contributor

Summary

SECURITY-DEFAULTS.md states unconditionally that "VPC Flow Logs ... are enabled by default (enable_flow_logs = true)". That's true for single-vm/aws and unlimited-scale/aws, but ha-hot-hot/aws had no enable_flow_logs variable, no aws_flow_log resource, and no flow-log IAM role at all — so asm-aws-ha and sat-aws-ha customers got no network flow visibility despite the docs promising it.

This gap (and the parallel Azure-side gap — no Azure module has NSG flow logs today) is tracked in #47, which explicitly recommends splitting the fix into an AWS PR (this one) and a separate Azure PR, since Azure needs a destination-resource decision first (Log Analytics Workspace vs. Storage Account) that AWS doesn't.

Changes

Ports the existing pattern from modules/unlimited-scale/aws/main.tf verbatim into modules/ha-hot-hot/aws:

  • aws_cloudwatch_log_group.flow_logs, aws_iam_role.flow_logs, aws_iam_role_policy.flow_logs, aws_flow_log.vpc — all gated on count = var.enable_flow_logs ? 1 : 0
  • New enable_flow_logs variable (bool, default true), matching the single-vm/unlimited-scale convention
  • New flow_log_group_name output
  • Forwarded through asm-aws-ha and sat-aws-ha (variable + output)
  • terraform test coverage: a default-on assertion added to tests/basic.tftest.hcl, plus enabled/disabled plan checks added to tests/feature_flags.tftest.hcl (mirrors the existing kms_* / redis_* flag-test pattern in the same file)

No existing resources are modified. enable_flow_logs defaults to true, so existing ha-hot-hot/aws, asm-aws-ha, and sat-aws-ha deployments will see one new aws_cloudwatch_log_group, one new aws_iam_role, one new aws_iam_role_policy, and one new aws_flow_log on their next terraform apply — no replacements, no downtime.

Out of scope

The Azure side of #47 (single-vm/azure, ha-hot-hot/azure, unlimited-scale/azure — none have NSG/Network Watcher flow logs) is left for a follow-up PR, per #47's own recommendation.

Test plan

  • terraform validate passes on modules/ha-hot-hot/aws, modules/asm-aws-ha, modules/sat-aws-ha
  • terraform test — 8/8 passing on ha-hot-hot/aws, including the 2 new flow-log runs (flow_logs_enabled_by_default, flow_logs_disabled_creates_nothing)
  • tflint / checkov / trivy — not runnable in this sandbox (network policy blocks the release-artifact downloads for these tools); the added resources are a verbatim copy of the pattern already clean under all three in unlimited-scale/aws, and the existing global .checkov.yaml skip-checks (CKV_AWS_338, CKV_AWS_158) already cover this resource shape, so no new suppression is expected. Will confirm once CI runs.

Closes the AWS half of #47.


Generated by Claude Code

SECURITY-DEFAULTS.md claims "VPC Flow Logs ... enabled by default
(enable_flow_logs = true)" for every module, but ha-hot-hot/aws had no
enable_flow_logs variable, no aws_flow_log resource, and no flow-log IAM
role — tracked in #47 as the AWS-side half of a larger cross-module gap.

Ports the existing pattern from unlimited-scale/aws verbatim:
aws_cloudwatch_log_group.flow_logs, aws_iam_role.flow_logs,
aws_iam_role_policy.flow_logs, aws_flow_log.vpc, all gated on
enable_flow_logs (default true). Adds flow_log_group_name output and
forwards the variable/output through asm-aws-ha and sat-aws-ha. Adds
terraform test coverage: default-on assertion in tests/basic.tftest.hcl,
plus enabled/disabled plan checks in tests/feature_flags.tftest.hcl.

No existing resources changed; enable_flow_logs=true is additive only.
Existing deployments get one new CloudWatch log group, IAM role, and
flow log on their next apply.

The Azure NSG flow-log side of #47 (single-vm/azure, ha-hot-hot/azure,
unlimited-scale/azure — no Azure module has this at all) is out of
scope here per #47's own recommendation to split AWS and Azure work.

Verified locally: terraform validate and terraform test (8/8 passing,
including the 2 new flow-log runs) on ha-hot-hot/aws, asm-aws-ha, and
sat-aws-ha. tflint/checkov/trivy could not run in this sandbox (network
policy blocks the release-artifact downloads); the change is a verbatim
copy of the pattern already tflint/checkov-clean in unlimited-scale/aws,
and no new checkov suppression is expected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TRS3XkFnAjqmeaK5v9Vv5q
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