github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/aws/resource_aws_opsworks_permission_test.go (about)

     1  package aws
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/resource"
     7  )
     8  
     9  func TestAccAWSOpsworksPermission(t *testing.T) {
    10  	resource.Test(t, resource.TestCase{
    11  		PreCheck:  func() { testAccPreCheck(t) },
    12  		Providers: testAccProviders,
    13  		Steps: []resource.TestStep{
    14  			resource.TestStep{
    15  				Config: testAccAwsOpsworksPermissionCreate,
    16  				Check: resource.ComposeTestCheckFunc(
    17  					resource.TestCheckResourceAttr(
    18  						"aws_opsworks_permission.tf-acc-perm", "allow_ssh", "true",
    19  					),
    20  					resource.TestCheckResourceAttr(
    21  						"aws_opsworks_permission.tf-acc-perm", "allow_sudo", "true",
    22  					),
    23  					resource.TestCheckResourceAttr(
    24  						"aws_opsworks_permission.tf-acc-perm", "level", "iam_only",
    25  					),
    26  				),
    27  			},
    28  		},
    29  	})
    30  }
    31  
    32  var testAccAwsOpsworksPermissionCreate = testAccAwsOpsworksUserProfileCreate + `
    33  resource "aws_opsworks_permission" "tf-acc-perm" {
    34    stack_id = "${aws_opsworks_stack.tf-acc.id}"
    35  
    36    allow_ssh = true
    37    allow_sudo = true
    38    user_arn = "${aws_opsworks_user_profile.user.user_arn}"
    39    level = "iam_only"
    40  }
    41  `