Skip to content

Datatamer/terraform-aws-security-groups

Repository files navigation

Security Groups Module

This module creates security groups.

Examples

Basic

Inline example implementation of the module. This is the most basic example of what it would look like to use this module.

module "aws-sg" {
  source = "git::https://github.com/Datatamer/terraform-aws-security-groups.git?ref=x.y.z"
  vpc_id = "vpc-123456789"
  ingress_cidr_blocks = [
    "1.2.3.4/32"
  ]
  egress_cidr_blocks  = [
    "0.0.0.0/0"
  ]
  ingress_ports = [8080, 9090]
  ingress_protocol = "tcp"
  egress_protocol = "all"
  sg_name_prefix = "security-group-example"
}

Resources Created

This module creates:

  • security groups for ingress
  • security groups for egress
  • security group rules

Requirements

Name Version
terraform >= 0.13
aws >= 3.36, !=4.0.0, !=4.1.0, !=4.2.0, !=4.3.0, !=4.4.0, !=4.5.0, !=4.6.0, !=4.7.0, !=4.8.0

Providers

Name Version
aws >= 3.36, !=4.0.0, !=4.1.0, !=4.2.0, !=4.3.0, !=4.4.0, !=4.5.0, !=4.6.0, !=4.7.0, !=4.8.0

Inputs

Name Description Type Default Required
egress_protocol Protocol for egress rules. If not icmp, icmpv6, tcp, udp, or all use the protocol number. string n/a yes
ingress_ports Ports to create ingress traffic rules for list(number) n/a yes
ingress_protocol Protocol for ingress rules. If not icmp, icmpv6, tcp, udp, or all use the protocol number. string n/a yes
sg_name_prefix Prefix for security group names string n/a yes
vpc_id The ID of the VPC in which to attach the security group string n/a yes
egress_cidr_blocks CIDR blocks to attach to security groups for egress list(string) [] no
egress_security_groups Existing security groups to attach to new security groups for egress list(string) [] no
ingress_cidr_blocks CIDR blocks to attach to security groups for ingress list(string) [] no
ingress_security_groups Existing security groups to attach to new security groups for ingress list(string) [] no
maximum_rules_per_sg Maximum number of rules for each security group number 50 no
tags A map of tags to add to all resources. map(string) {} no

Outputs

Name Description
egress_security_group_ids IDs of the security groups that control egress to the resource
ingress_security_group_ids IDs of the security groups that control ingress to the resource
security_group_ids IDs of the security groups created by this module
security_groups Security groups created by this module

References

This repo is based on:

License

Apache 2 Licensed. See LICENSE for full details.

About

Terraform module for terraform-aws-security-groups

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7