finds.dev

terraform-aws-modules/terraform-aws-security-group

Terraform module to create AWS Security Group resources 🇺🇦

View on GitHubHomepage ↗

★ 591HCLNOASSERTIONupdated Aug 2026

// the take

The standard terraform-aws-modules module for creating an EC2 security group and its rules, with ~40 preset submodules (postgresql, redis, kafka, ldap, etc.) that ship sane default ports so you don't have to look them up. For teams already standardized on the terraform-aws-modules ecosystem, or anyone tired of writing the same ingress/egress blocks by hand.

Uses the newer aws_vpc_security_group_ingress_rule/egress_rule resources instead of inline ingress/egress blocks, which avoids the classic Terraform problem of inline rules clobbering each other across configs. create_before_destroy is set on the security group so a forced replacement doesn't drop traffic mid-apply. The 'self' sentinel for referenced_security_group_id is a nice touch — no more looking up the SG's own id to allow intra-group traffic. Preset submodules under modules/ save you from memorizing that Cassandra needs 7000, 7001, 7199, 9042 and 9160.

enable_exclusive_rules defaults to true, which means any rule added out-of-band — console, another Terraform root, a script — gets silently reverted on the next apply. Fine if this module is the sole owner of the SG, a landmine if anything else ever touches it. use_name_prefix = false plus any change that forces replacement (protocol/port changes on some rule types) will fail apply outright because AWS won't allow a duplicate name in the same VPC; the workaround is documented but it's still a footgun you can hit in CI. Requires AWS provider >= 6.29, so older pinned provider versions can't adopt it without a wider upgrade. Like most of the terraform-aws-modules family, major version bumps tend to require coordinated provider/module upgrades together, which is more upgrade friction than a hand-rolled module.

We read the README, the directory tree and a key source file in November 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
591
Forks
1,139
Language
HCL
License
NOASSERTION
Last commit
6 Aug 2026

// nearby

If terraform-aws-security-group isn't quite it.

All repos →