github.com/koding/terraform@v0.6.4-0.20170608090606-5d7e0339779d/builtin/providers/aws/data_source_aws_ssm_parameter_test.go (about) 1 package aws 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/hashicorp/terraform/helper/resource" 8 ) 9 10 func TestAccAwsSsmParameterDataSource_basic(t *testing.T) { 11 name := "test.parameter" 12 resource.Test(t, resource.TestCase{ 13 PreCheck: func() { 14 testAccPreCheck(t) 15 }, 16 Providers: testAccProviders, 17 Steps: []resource.TestStep{ 18 { 19 Config: testAccCheckAwsSsmParameterDataSourceConfig(name), 20 Check: resource.ComposeAggregateTestCheckFunc( 21 resource.TestCheckResourceAttr("data.aws_ssm_parameter.test", "name", name), 22 resource.TestCheckResourceAttr("data.aws_ssm_parameter.test", "type", "String"), 23 resource.TestCheckResourceAttr("data.aws_ssm_parameter.test", "value", "TestValue"), 24 ), 25 }, 26 }, 27 }) 28 } 29 30 func testAccCheckAwsSsmParameterDataSourceConfig(name string) string { 31 return fmt.Sprintf(` 32 resource "aws_ssm_parameter" "test" { 33 name = "%s" 34 type = "String" 35 value = "TestValue" 36 } 37 38 data "aws_ssm_parameter" "test" { 39 name = "${aws_ssm_parameter.test.name}" 40 } 41 `, name) 42 }