Difference between revisions of "Terraform resource: aws security group rule"

From wikieduonline
Jump to navigation Jump to search
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
  aws_security_group_rule
+
  aws_security_group_rule ([https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule ref])
* https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule
 
  
 
  [[from_port]]
 
  [[from_port]]
 
  [[to_port]]
 
  [[to_port]]
  [[protocol]] (required): <code>icmp, icmpv6, tcp, udp, or all</code>  
+
  [[protocol]] (required): <code>icmp, icmpv6, tcp, udp, or all (or protocol = -1)</code>  
  
 +
[[terraform import]] aws_ecs_service.imported cluster-name/service-name
 +
 +
== Official example ==
 +
resource "aws_security_group_rule" "example" {
 +
  type              = "ingress"
 +
  [[from_port]]        = 0
 +
  to_port          = 65535
 +
  protocol          = "tcp"
 +
  [[cidr_blocks]]      = [aws_vpc.example.cidr_block]
 +
  ipv6_cidr_blocks  = [aws_vpc.example.ipv6_cidr_block]
 +
  security_group_id = "sg-123456"
 +
}
  
 
== Related ==
 
== Related ==
* <code>[[ingress]]</code>
+
* [[Security groups for your Network Load Balancer (NLB)]]
 +
* <code>[[ingress]], [[egress]]</code>
 
* <code>[[aws ec2 authorize-security-group-ingress]]</code>
 
* <code>[[aws ec2 authorize-security-group-ingress]]</code>
 +
* <code>[[aws ec2 authorize-security-group-egress]]</code>
 
* <code>[[aws_security_group]]</code>
 
* <code>[[aws_security_group]]</code>
 
* <code>[[data.aws_subnet.all_public]]</code>
 
* <code>[[data.aws_subnet.all_public]]</code>
[[cidr_blocks]]
+
* [[cidr_blocks]]
[[Tags]]
+
* [[Tags]]
 
 
tags = {
 
    name = "your SG name"
 
}
 
  
 
== See also ==
 
== See also ==
* {{terraform aws resources}}
+
* {{tf sg}}
 
* {{SG}}
 
* {{SG}}
  
 
[[Category:Terraform]]
 
[[Category:Terraform]]

Latest revision as of 15:18, 4 September 2023

aws_security_group_rule (ref)
from_port
to_port
protocol (required): icmp, icmpv6, tcp, udp, or all (or protocol = -1) 
terraform import aws_ecs_service.imported cluster-name/service-name

Official example[edit]

resource "aws_security_group_rule" "example" {
  type              = "ingress"
  from_port         = 0
  to_port           = 65535
  protocol          = "tcp"
  cidr_blocks       = [aws_vpc.example.cidr_block]
  ipv6_cidr_blocks  = [aws_vpc.example.ipv6_cidr_block]
  security_group_id = "sg-123456"
}

Related[edit]

See also[edit]

Advertising: