github.com/minamijoyo/terraform@v0.7.8-0.20161029001309-18b3736ba44b/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 = testAccAWSOpsUserConfig + 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  `
    38  
    39  var testAccAWSOpsUserConfig = `
    40  resource "aws_iam_user" "user" {
    41  	name = "test-user"
    42  	path = "/"
    43  }
    44  `