Skip to content

Commit

Permalink
r/aws_securityhub: Address review comments for aws_securityhub_account
Browse files Browse the repository at this point in the history
  • Loading branch information
gazoakley committed Dec 13, 2018
1 parent a78acc8 commit 7556edb
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion aws/resource_aws_securityhub_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func resourceAwsSecurityHubAccountCreate(d *schema.ResourceData, meta interface{
return fmt.Errorf("Error enabling Security Hub for account: %s", err)
}

d.SetId("securityhub-account")
d.SetId(meta.(*AWSClient).accountid)

return resourceAwsSecurityHubAccountRead(d, meta)
}
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_aws_securityhub_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform/terraform"
)

func TestAccAWSSecurityHubAccount_basic(t *testing.T) {
func testAccAWSSecurityHubAccount_basic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand Down
25 changes: 25 additions & 0 deletions aws/resource_aws_securityhub_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package aws

import (
"testing"
)

func TestAccAWSSecurityHub(t *testing.T) {
testCases := map[string]map[string]func(t *testing.T){
"Account": {
"basic": testAccAWSSecurityHubAccount_basic,
},
}

for group, m := range testCases {
m := m
t.Run(group, func(t *testing.T) {
for name, tc := range m {
tc := tc
t.Run(name, func(t *testing.T) {
tc(t)
})
}
})
}
}
14 changes: 7 additions & 7 deletions website/docs/r/securityhub_account.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ layout: "aws"
page_title: "AWS: aws_securityhub_account"
sidebar_current: "docs-aws-resource-securityhub-account"
description: |-
Enables Security Hub.
Enables Security Hub for an AWS account.
---

# aws_securityhub_account

-> **Note:** Destroying this resource will disable Security Hub.
-> **Note:** Destroying this resource will disable Security Hub for this AWS account.

Enables Security Hub.
Enables Security Hub for this AWS account.

## Example Usage

```hcl
resource "aws_securityhub_member" "example" {}
resource "aws_securityhub_account" "example" {}
```

## Argument Reference
Expand All @@ -26,12 +26,12 @@ The resource does not support any arguments.

The following attributes are exported in addition to the arguments listed above:

* `id` - Returns `securityhub-account`.
* `id` - AWS Account ID.

## Import

Security Hub account enablemenet can be imported using the word `securityhub-account`, e.g.
An existing Security Hub enabled account can be imported using the AWS account ID, e.g.

```
$ terraform import aws_securityhub_account.example securityhub-account
$ terraform import aws_securityhub_account.example 123456789012
```

0 comments on commit 7556edb

Please sign in to comment.