Resource: aws_vpc_security_group_egress_rule

Manages an outbound (egress) rule for a security group.

When specifying an outbound rule for your security group in a VPC, the configuration must include a destination for the traffic.

Example Usage

resource "aws_vpc_security_group_egress_rule" "example" {
  security_group_id = aws_security_group.example.id

  cidr_ipv4   = "10.0.0.0/8"
  from_port   = 80
  ip_protocol = "tcp"
  to_port     = 80
}

Argument Reference

This argument supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import security group egress rules using the security_group_rule_id. For example:

import {
  to = aws_vpc_security_group_egress_rule.example
  id = "sgr-02108b27edd666983"
}

Using terraform import, import security group egress rules using the security_group_rule_id. For example:

% terraform import aws_vpc_security_group_egress_rule.example sgr-02108b27edd666983