github.com/chalford/terraform@v0.3.7-0.20150113080010-a78c69a8c81f/website/source/docs/providers/aws/r/security_group.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_security_group" 4 sidebar_current: "docs-aws-resource-security-group" 5 description: |- 6 Provides an security group resource. 7 --- 8 9 # aws\_security\_group 10 11 Provides an security group resource. 12 13 ## Example Usage 14 15 Basic usage 16 17 ``` 18 resource "aws_security_group" "allow_all" { 19 name = "allow_all" 20 description = "Allow all inbound traffic" 21 22 ingress { 23 from_port = 0 24 to_port = 65535 25 protocol = "tcp" 26 cidr_blocks = ["0.0.0.0/0"] 27 } 28 } 29 ``` 30 31 Basic usage with tags: 32 33 ``` 34 resource "aws_security_group" "allow_all" { 35 name = "allow_all" 36 description = "Allow all inbound traffic" 37 38 ingress { 39 from_port = 0 40 to_port = 65535 41 protocol = "tcp" 42 cidr_blocks = ["0.0.0.0/0"] 43 } 44 45 tags { 46 Name = "allow_all" 47 } 48 } 49 ``` 50 51 ## Argument Reference 52 53 The following arguments are supported: 54 55 * `name` - (Required) The name of the security group 56 * `description` - (Required) The security group description. 57 * `ingress` - (Optional) Can be specified multiple times for each 58 ingress rule. Each ingress block supports fields documented below. 59 * `vpc_id` - (Optional) The VPC ID. 60 * `owner_id` - (Optional) The AWS Owner ID. 61 62 The `ingress` block supports: 63 64 * `cidr_blocks` - (Optional) List of CIDR blocks. Cannot be used with `security_groups`. 65 * `from_port` - (Required) The start port. 66 * `protocol` - (Required) The protocol. 67 * `security_groups` - (Optional) List of security group IDs. Cannot be used with `cidr_blocks`. 68 * `self` - (Optional) If true, the security group itself will be added as 69 a source to this ingress rule. 70 * `to_port` - (Required) The end range port. 71 * `tags` - (Optional) A mapping of tags to assign to the resource. 72 73 ## Attributes Reference 74 75 The following attributes are exported: 76 77 * `id` - The ID of the security group 78 * `vpc_id` - The VPC ID. 79 * `owner_id` - The owner ID. 80 * `name` - The name of the security group 81 * `description` - The description of the security group 82 * `ingress` - The ingress rules. See above for more.