feat(single-vm/aws): add VPC Flow Logs to close SECURITY-DEFAULTS gap#9
Closed
dmchaledev wants to merge 3 commits into
Closed
feat(single-vm/aws): add VPC Flow Logs to close SECURITY-DEFAULTS gap#9dmchaledev wants to merge 3 commits into
dmchaledev wants to merge 3 commits into
Conversation
SECURITY-DEFAULTS.md has long claimed VPC Flow Logs are enabled by default, but the single-vm/aws core module had no flow-log resources. This gap meant customers relying on the documented default had no flow logs at all. Adds the same pattern already present in unlimited-scale/aws: - aws_cloudwatch_log_group (30-day retention, optional CMK) - aws_iam_role + aws_iam_role_policy scoped to that log group - aws_flow_log targeting the caller-provided vpc_id Variable enable_flow_logs defaults to true (matching SECURITY-DEFAULTS.md). Wrappers asm-aws-single and sat-aws-single are updated to forward the variable and re-export the new flow_log_group_name output so the wrapper-forwarding CI gate passes. ha-hot-hot/aws has the same gap and is tracked separately. https://claude.ai/code/session_01B6D637ANdrxC826zTQmSYi
dmchaledev
pushed a commit
that referenced
this pull request
Jun 26, 2026
…erage Folds two open PRs that could not be merged from their own branches (their mock-based tests broke once rebased and the branches are not pushable here); re-implemented with the test gaps fixed. #9 — VPC Flow Logs for single-vm/aws (closes #9): Adds opt-in VPC Flow Logs (enable_flow_logs, default true) sending ALL traffic to a CloudWatch log group, with a least-privilege flow-log IAM role. Closes the gap vs SECURITY-DEFAULTS.md. Forwarded through asm-aws-single / sat-aws-single with a flow_log_group_name output. The existing single-vm/aws basic test now mocks aws_cloudwatch_log_group with a valid ARN so aws_flow_log's log_destination passes provider-side ARN validation. #34 — terraform test coverage for the network modules (closes #34): Adds .tftest.hcl suites for network/aws (basic apply + feature-flag plans) and network/azure (basic apply), and adds both to the terraform-test CI matrix — the only modules previously lacking native tests. The azure test mocks azurerm_network_security_group, and both network/aws tests mock aws_cloudwatch_log_group, with well-formed ARNs so the subnet-NSG association and flow-log destination validate under the mock provider. Verified locally: terraform validate, tflint, terraform test (single-vm/aws 5/5, network/aws 5/5, network/azure 1/1), checkov (1078 passed, 0 failed), trivy (0 findings), and the wrapper drift check (0 warnings) all pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFfgnPaoyGhp52vQL2PVU3
Contributor
Author
|
Superseded by #41 (merged), which lands the VPC Flow Logs feature for single-vm/aws (+ asm/sat wrappers and the Generated by Claude Code |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SECURITY-DEFAULTS.mdhas always stated:But
modules/single-vm/awshad zero flow-log resources — noaws_flow_log, no CloudWatch log group, no IAM role. Customers reading the security documentation and deploying the single-vm tier had no flow logs at all, creating a silent compliance and forensics gap.unlimited-scale/awsalready ships the correct implementation. This PR ports that pattern tosingle-vm/awsand updates both product wrappers to keep thewrapper-forwardingCI gate green.Changes
modules/single-vm/aws/variables.tfenable_flow_logs(bool, defaulttrue)modules/single-vm/aws/main.tfaws_cloudwatch_log_group,aws_iam_role,aws_iam_role_policy,aws_flow_log— identical pattern tounlimited-scale/awsmodules/single-vm/aws/outputs.tfflow_log_group_nameoutputmodules/asm-aws-single/{variables,main,outputs}.tfenable_flow_logs, re-exportflow_log_group_namemodules/sat-aws-single/{variables,main,outputs}.tfNo new Checkov suppressions needed —
CKV_AWS_338(CW log retention < 1 year) andCKV_AWS_158(CW log group KMS when CMK is off) are already suppressed with documented rationale, and the#tfsec:ignore:aws-iam-no-policy-wildcardsinline annotation handles thelogs:DescribeLogGroups Resource = "*"requirement exactly as inunlimited-scale/aws.What this does NOT change
ha-hot-hot/awshas the same gap. That's a larger module with its own VPC and more surface area — tracked separately so this small, self-contained fix can ship now.single-vm/azureNSG flow log parity is a follow-on.enable_flow_logs = true(the new default) on a VPC that already has a flow log is additive — AWS supports multiple flow log configurations per VPC. Operators who want to opt out can setenable_flow_logs = false.Test plan
terraform validatepasses onmodules/single-vm/aws,asm-aws-single,sat-aws-singlewrapper-forwardingcheck passes (new variable is forwarded by both wrappers)tflintpassescheckovpasses (no new suppressions added)flow_log_group_nameoutput is non-empty afterterraform applyon a test VPChttps://claude.ai/code/session_01B6D637ANdrxC826zTQmSYi
Generated by Claude Code