2017-01-19 15:08:56 +01:00
---
layout: "alicloud"
page_title: "Alicloud: alicloud_security_group"
2017-04-05 17:30:46 +02:00
sidebar_current: "docs-alicloud-resource-security-group."
2017-01-19 15:08:56 +01:00
description: |-
Provides a Alicloud Security Group resource.
---
2017-04-05 17:30:46 +02:00
# alicloud_security_group
2017-01-19 15:08:56 +01:00
Provides a security group resource.
~> **NOTE:** `alicloud_security_group` is used to build and manage a security group, and `alicloud_security_group_rule` can define ingress or egress rules for it.
## Example Usage
Basic Usage
2017-04-05 17:30:46 +02:00
```hcl
2017-01-19 15:08:56 +01:00
resource "alicloud_security_group" "group" {
2017-02-18 23:48:50 +01:00
name = "terraform-test-group"
description = "New security group"
2017-01-19 15:08:56 +01:00
}
```
2017-04-05 17:30:46 +02:00
2017-01-19 15:08:56 +01:00
Basic usage for vpc
2017-04-05 17:30:46 +02:00
```hcl
2017-01-19 15:08:56 +01:00
resource "alicloud_security_group" "group" {
2017-02-18 23:48:50 +01:00
name = "new-group"
vpc_id = "${alicloud_vpc.vpc.id}"
2017-01-19 15:08:56 +01:00
}
resource "alicloud_vpc" "vpc" {
2017-02-18 23:48:50 +01:00
cidr_block = "10.1.0.0/21"
2017-01-19 15:08:56 +01:00
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Optional) The name of the security group. Defaults to null.
* `description` - (Optional, Forces new resource) The security group description. Defaults to null.
* `vpc_id` - (Optional, Forces new resource) The VPC ID.
## Attributes Reference
The following attributes are exported:
* `id` - The ID of the security group
* `vpc_id` - The VPC ID.
* `name` - The name of the security group
2017-04-05 17:30:46 +02:00
* `description` - The description of the security group