Skip to content

Commit

Permalink
resource/aws_default_security_group: Ensure description attribute is …
Browse files Browse the repository at this point in the history
…written into Terraform state (#11650)

Output from acceptance testing:

```
--- PASS: TestAccAWSDefaultSecurityGroup_basic (9.33s)
--- PASS: TestAccAWSDefaultSecurityGroup_classic (12.37s)
```
  • Loading branch information
david-wells-1 authored Feb 6, 2020
1 parent d0d4464 commit 91d75b3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aws/resource_aws_default_security_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ func resourceAwsDefaultSecurityGroup() *schema.Resource {
dsg.Create = resourceAwsDefaultSecurityGroupCreate
dsg.Delete = resourceAwsDefaultSecurityGroupDelete

// Descriptions cannot be updated
delete(dsg.Schema, "description")
// description is a computed value for Default Security Groups and cannot be changed
dsg.Schema["description"] = &schema.Schema{
Type: schema.TypeString,
Computed: true,
}

// name is a computed value for Default Security Groups and cannot be changed
delete(dsg.Schema, "name_prefix")
Expand Down
2 changes: 2 additions & 0 deletions aws/resource_aws_default_security_group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ func TestAccAWSDefaultSecurityGroup_basic(t *testing.T) {
testAccCheckAWSDefaultSecurityGroupAttributes(&group),
resource.TestCheckResourceAttr(
"aws_default_security_group.web", "name", "default"),
resource.TestCheckResourceAttr(
"aws_default_security_group.web", "description", "default VPC security group"),
resource.TestCheckResourceAttr(
"aws_default_security_group.web", "ingress.3629188364.protocol", "tcp"),
resource.TestCheckResourceAttr(
Expand Down

0 comments on commit 91d75b3

Please sign in to comment.