github.com/ottenhoff/terraform@v0.7.0-rc1.0.20160607213102-ac2d195cc560/website/source/docs/providers/aws/r/security_group_rule.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_security_group_rule"
     4  sidebar_current: "docs-aws-resource-security-group-rule"
     5  description: |-
     6    Provides an security group rule resource.
     7  ---
     8  
     9  # aws\_security\_group\_rule
    10  
    11  Provides a security group rule resource. Represents a single `ingress` or
    12  `egress` group rule, which can be added to external Security Groups.
    13  
    14  ~> **NOTE on Security Groups and Security Group Rules:** Terraform currently
    15  provides both a standalone Security Group Rule resource (a single `ingress` or
    16  `egress` rule), and a [Security Group resource](security_group.html) with `ingress` and `egress` rules
    17  defined in-line. At this time you cannot use a Security Group with in-line rules
    18  in conjunction with any Security Group Rule resources. Doing so will cause
    19  a conflict of rule settings and will overwrite rules.
    20  
    21  ## Example Usage
    22  
    23  Basic usage
    24  
    25  ```
    26  resource "aws_security_group_rule" "allow_all" {
    27      type = "ingress"
    28      from_port = 0
    29      to_port = 65535
    30      protocol = "tcp"
    31      cidr_blocks = ["0.0.0.0/0"]
    32  
    33      security_group_id = "sg-123456"
    34  }
    35  ```
    36  
    37  ## Argument Reference
    38  
    39  The following arguments are supported:
    40  
    41  * `type` - (Required) The type of rule being created. Valid options are `ingress` (inbound)
    42  or `egress` (outbound).
    43  * `cidr_blocks` - (Optional) List of CIDR blocks. Cannot be specified with `source_security_group_id`.
    44  * `from_port` - (Required) The start port (or ICMP type number if protocol is "icmp").
    45  * `protocol` - (Required) The protocol.
    46  * `security_group_id` - (Required) The security group to apply this rule to.
    47  * `source_security_group_id` - (Optional) The security group id to allow access to/from,
    48       depending on the `type`. Cannot be specified with `cidr_blocks`.
    49  * `self` - (Optional) If true, the security group itself will be added as
    50       a source to this ingress rule.
    51  * `to_port` - (Required) The end range port.
    52  
    53  ## Attributes Reference
    54  
    55  The following attributes are exported:
    56  
    57  * `id` - The ID of the security group rule
    58  * `type` - The type of rule, `ingress` or `egress`
    59  * `from_port` - The source port
    60  * `to_port` - The destination port
    61  * `protocol` – The protocol used