Resource
aws.ec2.SecurityGroupIngress
Describes a security group rule.
Example
let vpc = aws.ec2.Vpc {
cidr_block = '10.0.0.0/16'
tags = {
Environment = 'example'
}
}
let sg = aws.ec2.SecurityGroup {
group_name = 'carina-example-sg-ingress'
description = 'SG for ingress rule example'
vpc_id = vpc.vpc_id
tags = {
Environment = 'example'
}
}
aws.ec2.SecurityGroupIngress {
group_id = sg.group_id
description = 'Allow HTTPS from VPC'
ip_protocol = tcp
from_port = 443
to_port = 443
cidr_ip = '10.0.0.0/16'
}
Argument Reference
cidr_ip
- Type:
Ipv4Cidr (custom validator) - Required: No
The IPv4 address range, in CIDR format. Amazon Web Services canonicalizes IPv4 and IPv6 CIDRs. For example, if you specify 100.68.0.18/18 for the CIDR block, Amazon Web Services canonicalizes the CIDR block to 100.68.0.0/18. Any subsequent DescribeSecurityGroups and DescribeSecurityGroupRules calls will return the canonicalized form of the CIDR block. Additionally, if you attempt to add another rule with the non-canonical form of the CIDR (such as 100.68.0.18/18) and there is already a rule for the canonicalized form of the CIDR block (such as 100.68.0.0/18), the API throws an duplicate rule error. To specify an IPv6 address range, use IP permissions instead. To specify multiple rules and descriptions for the rules, use IP permissions instead.
cidr_ipv6
- Type:
Ipv6Cidr (custom validator) - Required: No
The IPv6 CIDR range.
description
- Type:
String - Required: No
The security group rule description.
from_port
- Type:
Int (range: -1..=65535) - Required: No
If the protocol is TCP or UDP, this is the start of the port range. If the protocol is ICMP, this is the ICMP type or -1 (all ICMP types). To specify multiple rules and descriptions for the rules, use IP permissions instead.
group_id
- Type:
SecurityGroupId (pattern: /^sg-[0-9a-f]{8,}$/ (Full)) - Required: No
The ID of the security group.
ip_protocol
- Type: IpProtocol
- Required: Yes
The IP protocol name (tcp, udp, icmp) or number (see Protocol Numbers). To specify all protocols, use -1. To specify icmpv6, use IP permissions instead. If you specify a protocol other than one of the supported values, traffic is allowed on all ports, regardless of any ports that you specify. To specify multiple rules and descriptions for the rules, use IP permissions instead.
source_prefix_list_id
- Type:
PrefixListId (pattern: /^pl-[0-9a-f]{8,}$/ (Full)) - Required: No
The ID of the source prefix list.
source_security_group_owner_id
- Type:
AwsAccountId (pattern: /^[0-9]{12}$/ (Full), len: 12..=12) - Required: No
The Amazon Web Services account ID for the source security group, if the source security group is in a different account. The rule grants full ICMP, UDP, and TCP access. To create a rule with a specific protocol and port range, use IP permissions instead.
to_port
- Type:
Int (range: -1..=65535) - Required: No
If the protocol is TCP or UDP, this is the end of the port range. If the protocol is ICMP, this is the ICMP code or -1 (all ICMP codes). If the start port is -1 (all ICMP types), then the end port must be -1 (all ICMP codes). To specify multiple rules and descriptions for the rules, use IP permissions instead.
source_security_group_id
- Type:
SecurityGroupId (pattern: /^sg-[0-9a-f]{8,}$/ (Full)) - Required: No
The ID of the source security group.
Enum Values
ip_protocol (IpProtocol)
| Value | DSL Identifier |
|---|---|
tcp |
aws.ec2.SecurityGroupIngress.IpProtocol.tcp |
udp |
aws.ec2.SecurityGroupIngress.IpProtocol.udp |
icmp |
aws.ec2.SecurityGroupIngress.IpProtocol.icmp |
icmpv6 |
aws.ec2.SecurityGroupIngress.IpProtocol.icmpv6 |
-1 |
aws.ec2.SecurityGroupIngress.IpProtocol.all |
Shorthand formats: tcp or IpProtocol.tcp
Attribute Reference
security_group_rule_id
- Type:
SecurityGroupRuleId (pattern: /^sgr-[0-9a-f]{8,}$/ (Full)) - Read-only
The ID of the security group rule.