github.com/turtlemonvh/terraform@v0.6.9-0.20151204001754-8e40b6b855e8/builtin/providers/aws/resource_aws_iam_instance_profile_test.go (about)

     1  package aws
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/resource"
     7  )
     8  
     9  func TestAccAWSIAMInstanceProfile_basic(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: testAccAwsIamInstanceProfileConfig,
    16  			},
    17  		},
    18  	})
    19  }
    20  
    21  const testAccAwsIamInstanceProfileConfig = `
    22  resource "aws_iam_role" "test" {
    23  	name = "test"
    24  	assume_role_policy = "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"ec2.amazonaws.com\"]},\"Action\":[\"sts:AssumeRole\"]}]}"
    25  }
    26  
    27  resource "aws_iam_instance_profile" "test" {
    28  	name = "test"
    29  	roles = ["${aws_iam_role.test.name}"]
    30  }
    31  `