github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/cloudstack/r/security_group_rule.html.markdown (about) 1 --- 2 layout: "cloudstack" 3 page_title: "CloudStack: cloudstack_security_group_rule" 4 sidebar_current: "docs-cloudstack-resource-security-group-rule" 5 description: |- 6 Authorizes and revokes both ingress and egress rulea for a given security group. 7 --- 8 9 # cloudstack\_security\_group\_rule 10 11 Authorizes and revokes both ingress and egress rulea for a given security group. 12 13 ## Example Usage 14 15 ``` 16 resource "cloudstack_security_group_rule" "web" { 17 security_group_id = "e340b62b-fbc2-4081-8f67-e40455c44bce" 18 19 rule { 20 cidr_list = ["0.0.0.0/0"] 21 protocol = "tcp" 22 ports = ["80", "443"] 23 } 24 25 rule { 26 cidr_list = ["192.168.0.0/24", "192.168.1.0/25"] 27 protocol = "tcp" 28 ports = ["80-90", "443"] 29 traffic_type = "egress" 30 user_security_group_list = ["group01", "group02"] 31 } 32 } 33 ``` 34 35 ## Argument Reference 36 37 The following arguments are supported: 38 39 * `security_group_id` - (Required) The security group ID for which to create 40 the rules. Changing this forces a new resource to be created. 41 42 * `rule` - (Required) Can be specified multiple times. Each rule block supports 43 fields documented below. 44 45 The `rule` block supports: 46 47 * `cidr_list` - (Optional) A CIDR list to allow access to the given ports. 48 49 * `protocol` - (Required) The name of the protocol to allow. Valid options are: 50 `tcp`, `udp`, `icmp`, `all` or a valid protocol number. 51 52 * `icmp_type` - (Optional) The ICMP type to allow, or `-1` to allow `any`. This 53 can only be specified if the protocol is ICMP. (defaults 0) 54 55 * `icmp_code` - (Optional) The ICMP code to allow, or `-1` to allow `any`. This 56 can only be specified if the protocol is ICMP. (defaults 0) 57 58 * `ports` - (Optional) List of ports and/or port ranges to allow. This can only 59 be specified if the protocol is TCP, UDP, ALL or a valid protocol number. 60 61 * `traffic_type` - (Optional) The traffic type for the rule. Valid options are: 62 `ingress` or `egress` (defaults ingress). 63 64 * `user_security_group_list` - (Optional) A list of security groups to apply 65 the rules to. 66 67 ## Attributes Reference 68 69 The following attributes are exported: 70 71 * `id` - The security group ID for which the rules are created. 72