github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/providers/openstack/r/networking_secgroup_v2.html.markdown (about) 1 --- 2 layout: "openstack" 3 page_title: "OpenStack: openstack_networking_secgroup_v2" 4 sidebar_current: "docs-openstack-resource-networking-secgroup-v2" 5 description: |- 6 Manages a V2 Neutron security group resource within OpenStack. 7 --- 8 9 # openstack\_networking\_secgroup_v2 10 11 Manages a V2 neutron security group resource within OpenStack. 12 Unlike Nova security groups, neutron separates the group from the rules 13 and also allows an admin to target a specific tenant_id. 14 15 ## Example Usage 16 17 ```hcl 18 resource "openstack_networking_secgroup_v2" "secgroup_1" { 19 name = "secgroup_1" 20 description = "My neutron security group" 21 } 22 ``` 23 24 ## Argument Reference 25 26 The following arguments are supported: 27 28 * `region` - (Required) The region in which to obtain the V2 networking client. 29 A networking client is needed to create a port. If omitted, the 30 `OS_REGION_NAME` environment variable is used. Changing this creates a new 31 security group. 32 33 * `name` - (Required) A unique name for the security group. Changing this 34 creates a new security group. 35 36 * `description` - (Optional) A unique name for the security group. Changing this 37 creates a new security group. 38 39 * `tenant_id` - (Optional) The owner of the security group. Required if admin 40 wants to create a port for another tenant. Changing this creates a new 41 security group. 42 43 * `delete_default_rules` - (Optional) Whether or not to delete the default 44 egress security rules. This is `false` by default. See the below note 45 for more information. 46 47 ## Attributes Reference 48 49 The following attributes are exported: 50 51 * `region` - See Argument Reference above. 52 * `name` - See Argument Reference above. 53 * `description` - See Argument Reference above. 54 * `tenant_id` - See Argument Reference above. 55 56 ## Default Security Group Rules 57 58 In most cases, OpenStack will create some egress security group rules for each 59 new security group. These security group rules will not be managed by 60 Terraform, so if you prefer to have *all* aspects of your infrastructure 61 managed by Terraform, set `delete_default_rules` to `true` and then create 62 separate security group rules such as the following: 63 64 ```hcl 65 resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_v4" { 66 direction = "egress" 67 ethertype = "IPv4" 68 security_group_id = "${openstack_networking_secgroup_v2.secgroup.id}" 69 } 70 71 resource "openstack_networking_secgroup_rule_v2" "secgroup_rule_v6" { 72 direction = "egress" 73 ethertype = "IPv6" 74 security_group_id = "${openstack_networking_secgroup_v2.secgroup.id}" 75 } 76 ``` 77 78 Please note that this behavior may differ depending on the configuration of 79 the OpenStack cloud. The above illustrates the current default Neutron 80 behavior. Some OpenStack clouds might provide additional rules and some might 81 not provide any rules at all (in which case the `delete_default_rules` setting 82 is moot). 83 84 ## Import 85 86 Security Groups can be imported using the `id`, e.g. 87 88 ``` 89 $ terraform import openstack_networking_secgroup_v2.secgroup_1 38809219-5e8a-4852-9139-6f461c90e8bc 90 ```