github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/aws/resource_aws_inspector_resource_group_test.go (about) 1 package aws 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/hashicorp/terraform/helper/resource" 8 "github.com/hashicorp/terraform/terraform" 9 ) 10 11 func TestAccAWSInspectorResourceGroup_basic(t *testing.T) { 12 resource.Test(t, resource.TestCase{ 13 PreCheck: func() { testAccPreCheck(t) }, 14 Providers: testAccProviders, 15 Steps: []resource.TestStep{ 16 resource.TestStep{ 17 Config: testAccAWSInspectorResourceGroup, 18 Check: resource.ComposeTestCheckFunc( 19 testAccCheckAWSInspectorResourceGroupExists("aws_inspector_resource_group.foo"), 20 ), 21 }, 22 resource.TestStep{ 23 Config: testAccCheckAWSInspectorResourceGroupModified, 24 Check: resource.ComposeTestCheckFunc( 25 testAccCheckAWSInspectorTargetExists("aws_inspector_resource_group.foo"), 26 ), 27 }, 28 }, 29 }) 30 } 31 32 func testAccCheckAWSInspectorResourceGroupExists(name string) resource.TestCheckFunc { 33 return func(s *terraform.State) error { 34 _, ok := s.RootModule().Resources[name] 35 if !ok { 36 return fmt.Errorf("Not found: %s", name) 37 } 38 39 return nil 40 } 41 } 42 43 var testAccAWSInspectorResourceGroup = ` 44 resource "aws_inspector_resource_group" "foo" { 45 tags { 46 Name = "foo" 47 } 48 }` 49 50 var testAccCheckAWSInspectorResourceGroupModified = ` 51 resource "aws_inspector_resource_group" "foo" { 52 tags { 53 Name = "bar" 54 } 55 }`