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

     1  package aws
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/resource"
     7  )
     8  
     9  func TestAccAWSOpsworksUserProfile(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: testAccAwsOpsworksUserProfileCreate,
    16  				Check: resource.ComposeTestCheckFunc(
    17  					resource.TestCheckResourceAttr(
    18  						"aws_opsworks_user_profile.user", "ssh_public_key", "",
    19  					),
    20  					resource.TestCheckResourceAttr(
    21  						"aws_opsworks_user_profile.user", "ssh_username", "test-user",
    22  					),
    23  					resource.TestCheckResourceAttr(
    24  						"aws_opsworks_user_profile.user", "allow_self_management", "false",
    25  					),
    26  				),
    27  			},
    28  		},
    29  	})
    30  }
    31  
    32  var testAccAwsOpsworksUserProfileCreate = testAccAWSUserConfig + testAccAwsOpsworksStackConfigNoVpcCreate("tf-ops-acc-user-profile") + `
    33  resource "aws_opsworks_user_profile" "user" {
    34    user_arn = "${aws_iam_user.user.arn}"
    35    ssh_username = "${aws_iam_user.user.name}"
    36  }
    37  `