default-vpc.tf 835 B

123456789101112131415161718192021
  1. # Make the default VPC compliant
  2. resource "aws_default_vpc" "default" {
  3. tags = merge(var.standard_tags, var.tags, { "Notes" = "Not connected. For testing only. VPC not for production use." })
  4. }
  5. resource "aws_flow_log" "default-flowlogs" {
  6. iam_role_arn = aws_iam_role.flowlogs.arn
  7. log_destination = aws_cloudwatch_log_group.vpc_flow_logs.arn
  8. traffic_type = "REJECT" # CIS only requires reject, and "ALL" is expensive
  9. vpc_id = aws_default_vpc.default.id
  10. }
  11. # CIS 4.3 - Default security group should restrict all traffic
  12. #
  13. # This resource is special, and clears out existing rules. See:
  14. # See https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_security_group
  15. resource "aws_default_security_group" "default" {
  16. vpc_id = aws_default_vpc.default.id
  17. tags = merge(var.standard_tags, var.tags)
  18. }