@@ -77,6 +77,25 @@ func TestAccAWSService_byDNSName(t *testing.T) {
7777 })
7878}
7979
80+ func TestAccAWSService_byParts (t * testing.T ) {
81+ dataSourceName := "data.aws_service.test"
82+
83+ resource .ParallelTest (t , resource.TestCase {
84+ PreCheck : func () { testAccPreCheck (t ) },
85+ Providers : testAccProviders ,
86+ Steps : []resource.TestStep {
87+ {
88+ Config : testAccCheckAwsServiceConfig_byPart (),
89+ Check : resource .ComposeTestCheckFunc (
90+ resource .TestCheckResourceAttr (dataSourceName , "dns_name" , fmt .Sprintf ("%s.%s.%s" , s3 .EndpointsID , testAccGetRegion (), "amazonaws.com" )),
91+ resource .TestCheckResourceAttr (dataSourceName , "reverse_dns_name" , fmt .Sprintf ("%s.%s.%s" , "com.amazonaws" , testAccGetRegion (), s3 .EndpointsID )),
92+ resource .TestCheckResourceAttr (dataSourceName , "supported" , "true" ),
93+ ),
94+ },
95+ },
96+ })
97+ }
98+
8099func TestAccAWSService_unsupported (t * testing.T ) {
81100 dataSourceName := "data.aws_service.test"
82101
@@ -101,46 +120,46 @@ func TestAccAWSService_unsupported(t *testing.T) {
101120}
102121
103122func testAccCheckAwsServiceConfig_basic () string {
104- return fmt . Sprintf ( `
123+ return `
105124data "aws_service" "default" {}
106- ` )
125+ `
107126}
108127
109128func testAccCheckAwsServiceConfig_byReverseDNSName () string {
110129 // lintignore:AWSAT003
111- return fmt . Sprintf ( `
130+ return `
112131data "aws_service" "test" {
113132 reverse_dns_name = "cn.com.amazonaws.cn-north-1.s3"
114133}
115- ` )
134+ `
116135}
117136
118137func testAccCheckAwsServiceConfig_byDNSName () string {
119138 // lintignore:AWSAT003
120- return fmt . Sprintf ( `
139+ return `
121140data "aws_service" "test" {
122141 dns_name = "rds.us-east-1.amazonaws.com"
123142}
124- ` )
143+ `
125144}
126145
127146func testAccCheckAwsServiceConfig_byPart () string {
128- return fmt . Sprintf ( `
147+ return `
129148data "aws_region" "current" {}
130149
131150data "aws_service" "test" {
132151 reverse_dns_prefix = "com.amazonaws"
133152 region = data.aws_region.current.name
134153 service_id = "s3"
135154}
136- ` )
155+ `
137156}
138157
139158func testAccCheckAwsServiceConfig_unsupported () string {
140159 // lintignore:AWSAT003
141- return fmt . Sprintf ( `
160+ return `
142161data "aws_service" "test" {
143162 reverse_dns_name = "com.amazonaws.us-gov-west-1.waf"
144163}
145- ` )
164+ `
146165}
0 commit comments