@@ -77,6 +77,25 @@ func TestAccAWSService_byDNSName(t *testing.T) {
77
77
})
78
78
}
79
79
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
+
80
99
func TestAccAWSService_unsupported (t * testing.T ) {
81
100
dataSourceName := "data.aws_service.test"
82
101
@@ -101,46 +120,46 @@ func TestAccAWSService_unsupported(t *testing.T) {
101
120
}
102
121
103
122
func testAccCheckAwsServiceConfig_basic () string {
104
- return fmt . Sprintf ( `
123
+ return `
105
124
data "aws_service" "default" {}
106
- ` )
125
+ `
107
126
}
108
127
109
128
func testAccCheckAwsServiceConfig_byReverseDNSName () string {
110
129
// lintignore:AWSAT003
111
- return fmt . Sprintf ( `
130
+ return `
112
131
data "aws_service" "test" {
113
132
reverse_dns_name = "cn.com.amazonaws.cn-north-1.s3"
114
133
}
115
- ` )
134
+ `
116
135
}
117
136
118
137
func testAccCheckAwsServiceConfig_byDNSName () string {
119
138
// lintignore:AWSAT003
120
- return fmt . Sprintf ( `
139
+ return `
121
140
data "aws_service" "test" {
122
141
dns_name = "rds.us-east-1.amazonaws.com"
123
142
}
124
- ` )
143
+ `
125
144
}
126
145
127
146
func testAccCheckAwsServiceConfig_byPart () string {
128
- return fmt . Sprintf ( `
147
+ return `
129
148
data "aws_region" "current" {}
130
149
131
150
data "aws_service" "test" {
132
151
reverse_dns_prefix = "com.amazonaws"
133
152
region = data.aws_region.current.name
134
153
service_id = "s3"
135
154
}
136
- ` )
155
+ `
137
156
}
138
157
139
158
func testAccCheckAwsServiceConfig_unsupported () string {
140
159
// lintignore:AWSAT003
141
- return fmt . Sprintf ( `
160
+ return `
142
161
data "aws_service" "test" {
143
162
reverse_dns_name = "com.amazonaws.us-gov-west-1.waf"
144
163
}
145
- ` )
164
+ `
146
165
}
0 commit comments