github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/builtin/providers/aws/data_source_aws_elb_service_account_test.go (about)

     1  package aws
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/helper/resource"
     7  )
     8  
     9  func TestAccAWSElbServiceAccount_basic(t *testing.T) {
    10  	resource.Test(t, resource.TestCase{
    11  		PreCheck:  func() { testAccPreCheck(t) },
    12  		Providers: testAccProviders,
    13  		Steps: []resource.TestStep{
    14  			{
    15  				Config: testAccCheckAwsElbServiceAccountConfig,
    16  				Check: resource.ComposeTestCheckFunc(
    17  					resource.TestCheckResourceAttr("data.aws_elb_service_account.main", "id", "797873946194"),
    18  					resource.TestCheckResourceAttr("data.aws_elb_service_account.main", "arn", "arn:aws:iam::797873946194:root"),
    19  				),
    20  			},
    21  			{
    22  				Config: testAccCheckAwsElbServiceAccountExplicitRegionConfig,
    23  				Check: resource.ComposeTestCheckFunc(
    24  					resource.TestCheckResourceAttr("data.aws_elb_service_account.regional", "id", "156460612806"),
    25  					resource.TestCheckResourceAttr("data.aws_elb_service_account.regional", "arn", "arn:aws:iam::156460612806:root"),
    26  				),
    27  			},
    28  		},
    29  	})
    30  }
    31  
    32  const testAccCheckAwsElbServiceAccountConfig = `
    33  data "aws_elb_service_account" "main" { }
    34  `
    35  
    36  const testAccCheckAwsElbServiceAccountExplicitRegionConfig = `
    37  data "aws_elb_service_account" "regional" {
    38  	region = "eu-west-1"
    39  }
    40  `