@@ -176,6 +176,49 @@ func testAccRoute_grpcRoute(t *testing.T) {
176
176
acctest .CheckResourceAttrRegionalARN (resourceName , "arn" , "appmesh" , fmt .Sprintf ("mesh/%s/virtualRouter/%s/route/%s" , meshName , vrName , rName )),
177
177
),
178
178
},
179
+ {
180
+ Config : testAccRouteConfig_grpcRouteWithMaxRetriesZero (meshName , vrName , vn1Name , vn2Name , rName ),
181
+ Check : resource .ComposeTestCheckFunc (
182
+ testAccCheckAppmeshRouteExists (resourceName , & r ),
183
+ resource .TestCheckResourceAttr (resourceName , "name" , rName ),
184
+ resource .TestCheckResourceAttr (resourceName , "mesh_name" , meshName ),
185
+ acctest .CheckResourceAttrAccountID (resourceName , "mesh_owner" ),
186
+ resource .TestCheckResourceAttr (resourceName , "virtual_router_name" , vrName ),
187
+ resource .TestCheckResourceAttr (resourceName , "spec.#" , "1" ),
188
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.#" , "1" ),
189
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.action.#" , "1" ),
190
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.action.0.weighted_target.#" , "1" ),
191
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.match.#" , "1" ),
192
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.match.0.metadata.#" , "1" ),
193
+ resource .TestCheckTypeSetElemNestedAttrs (resourceName , "spec.0.grpc_route.0.match.0.metadata.*" , map [string ]string {
194
+ "invert" : "false" ,
195
+ "match.#" : "0" ,
196
+ "name" : "X-Testing1" ,
197
+ }),
198
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.match.0.method_name" , "" ),
199
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.match.0.service_name" , "" ),
200
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.#" , "1" ),
201
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.grpc_retry_events.#" , "2" ),
202
+ resource .TestCheckTypeSetElemAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.grpc_retry_events.*" , "deadline-exceeded" ),
203
+ resource .TestCheckTypeSetElemAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.grpc_retry_events.*" , "resource-exhausted" ),
204
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.http_retry_events.#" , "1" ),
205
+ resource .TestCheckTypeSetElemAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.http_retry_events.*" , "server-error" ),
206
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.max_retries" , "0" ),
207
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.per_retry_timeout.#" , "1" ),
208
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.per_retry_timeout.0.unit" , "s" ),
209
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.per_retry_timeout.0.value" , "15" ),
210
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.retry_policy.0.tcp_retry_events.#" , "0" ),
211
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.0.timeout.#" , "0" ),
212
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http2_route.#" , "0" ),
213
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.#" , "0" ),
214
+ resource .TestCheckResourceAttr (resourceName , "spec.0.tcp_route.#" , "0" ),
215
+ resource .TestCheckResourceAttr (resourceName , "tags.%" , "0" ),
216
+ resource .TestCheckResourceAttrSet (resourceName , "created_date" ),
217
+ resource .TestCheckResourceAttrSet (resourceName , "last_updated_date" ),
218
+ acctest .CheckResourceAttrAccountID (resourceName , "resource_owner" ),
219
+ acctest .CheckResourceAttrRegionalARN (resourceName , "arn" , "appmesh" , fmt .Sprintf ("mesh/%s/virtualRouter/%s/route/%s" , meshName , vrName , rName )),
220
+ ),
221
+ },
179
222
{
180
223
ResourceName : resourceName ,
181
224
ImportStateIdFunc : testAccRouteImportStateIdFunc (resourceName ),
@@ -1219,6 +1262,41 @@ func testAccRoute_httpRetryPolicy(t *testing.T) {
1219
1262
acctest .CheckResourceAttrRegionalARN (resourceName , "arn" , "appmesh" , fmt .Sprintf ("mesh/%s/virtualRouter/%s/route/%s" , meshName , vrName , rName )),
1220
1263
),
1221
1264
},
1265
+ {
1266
+ Config : testAccRouteConfig_httpMaxRetriesZero (meshName , vrName , vn1Name , vn2Name , rName ),
1267
+ Check : resource .ComposeTestCheckFunc (
1268
+ testAccCheckAppmeshRouteExists (resourceName , & r ),
1269
+ resource .TestCheckResourceAttr (resourceName , "name" , rName ),
1270
+ resource .TestCheckResourceAttr (resourceName , "mesh_name" , meshName ),
1271
+ acctest .CheckResourceAttrAccountID (resourceName , "mesh_owner" ),
1272
+ resource .TestCheckResourceAttr (resourceName , "virtual_router_name" , vrName ),
1273
+ resource .TestCheckResourceAttr (resourceName , "spec.#" , "1" ),
1274
+ resource .TestCheckResourceAttr (resourceName , "spec.0.grpc_route.#" , "0" ),
1275
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http2_route.#" , "0" ),
1276
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.#" , "1" ),
1277
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.action.#" , "1" ),
1278
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.action.0.weighted_target.#" , "1" ),
1279
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.match.#" , "1" ),
1280
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.match.0.header.#" , "0" ),
1281
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.match.0.method" , "" ),
1282
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.match.0.prefix" , "/" ),
1283
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.match.0.scheme" , "" ),
1284
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.retry_policy.#" , "1" ),
1285
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.retry_policy.0.http_retry_events.#" , "1" ),
1286
+ resource .TestCheckTypeSetElemAttr (resourceName , "spec.0.http_route.0.retry_policy.0.http_retry_events.*" , "server-error" ),
1287
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.retry_policy.0.max_retries" , "0" ),
1288
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.retry_policy.0.per_retry_timeout.#" , "1" ),
1289
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.retry_policy.0.per_retry_timeout.0.unit" , "s" ),
1290
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.retry_policy.0.per_retry_timeout.0.value" , "15" ),
1291
+ resource .TestCheckResourceAttr (resourceName , "spec.0.http_route.0.retry_policy.0.tcp_retry_events.#" , "0" ),
1292
+ resource .TestCheckResourceAttr (resourceName , "spec.0.tcp_route.#" , "0" ),
1293
+ resource .TestCheckResourceAttr (resourceName , "tags.%" , "0" ),
1294
+ resource .TestCheckResourceAttrSet (resourceName , "created_date" ),
1295
+ resource .TestCheckResourceAttrSet (resourceName , "last_updated_date" ),
1296
+ acctest .CheckResourceAttrAccountID (resourceName , "resource_owner" ),
1297
+ acctest .CheckResourceAttrRegionalARN (resourceName , "arn" , "appmesh" , fmt .Sprintf ("mesh/%s/virtualRouter/%s/route/%s" , meshName , vrName , rName )),
1298
+ ),
1299
+ },
1222
1300
{
1223
1301
Config : testAccRouteConfig_httpRetryPolicyUpdated (meshName , vrName , vn1Name , vn2Name , rName ),
1224
1302
Check : resource .ComposeTestCheckFunc (
@@ -1646,6 +1724,51 @@ resource "aws_appmesh_route" "test" {
1646
1724
` , rName ))
1647
1725
}
1648
1726
1727
+ func testAccRouteConfig_grpcRouteWithMaxRetriesZero (meshName , vrName , vn1Name , vn2Name , rName string ) string {
1728
+ return acctest .ConfigCompose (testAccAppmeshRouteConfigBase (meshName , vrName , "grpc" , vn1Name , vn2Name ), fmt .Sprintf (`
1729
+ resource "aws_appmesh_route" "test" {
1730
+ name = %[1]q
1731
+ mesh_name = aws_appmesh_mesh.test.id
1732
+ virtual_router_name = aws_appmesh_virtual_router.test.name
1733
+
1734
+ spec {
1735
+ grpc_route {
1736
+ match {
1737
+ metadata {
1738
+ name = "X-Testing1"
1739
+ }
1740
+ }
1741
+
1742
+ retry_policy {
1743
+ grpc_retry_events = [
1744
+ "deadline-exceeded",
1745
+ "resource-exhausted",
1746
+ ]
1747
+
1748
+ http_retry_events = [
1749
+ "server-error",
1750
+ ]
1751
+
1752
+ max_retries = 0
1753
+
1754
+ per_retry_timeout {
1755
+ unit = "s"
1756
+ value = 15
1757
+ }
1758
+ }
1759
+
1760
+ action {
1761
+ weighted_target {
1762
+ virtual_node = aws_appmesh_virtual_node.foo.name
1763
+ weight = 100
1764
+ }
1765
+ }
1766
+ }
1767
+ }
1768
+ }
1769
+ ` , rName ))
1770
+ }
1771
+
1649
1772
func testAccRouteConfig_http2Route (meshName , vrName , vn1Name , vn2Name , rName string ) string {
1650
1773
return acctest .ConfigCompose (testAccAppmeshRouteConfigBase (meshName , vrName , "http2" , vn1Name , vn2Name ), fmt .Sprintf (`
1651
1774
resource "aws_appmesh_route" "test" {
@@ -2284,6 +2407,44 @@ resource "aws_appmesh_route" "test" {
2284
2407
` , rName ))
2285
2408
}
2286
2409
2410
+ func testAccRouteConfig_httpMaxRetriesZero (meshName , vrName , vn1Name , vn2Name , rName string ) string {
2411
+ return acctest .ConfigCompose (testAccAppmeshRouteConfigBase (meshName , vrName , "http" , vn1Name , vn2Name ), fmt .Sprintf (`
2412
+ resource "aws_appmesh_route" "test" {
2413
+ name = %[1]q
2414
+ mesh_name = aws_appmesh_mesh.test.id
2415
+ virtual_router_name = aws_appmesh_virtual_router.test.name
2416
+
2417
+ spec {
2418
+ http_route {
2419
+ match {
2420
+ prefix = "/"
2421
+ }
2422
+
2423
+ retry_policy {
2424
+ http_retry_events = [
2425
+ "server-error",
2426
+ ]
2427
+
2428
+ max_retries = 0
2429
+
2430
+ per_retry_timeout {
2431
+ unit = "s"
2432
+ value = 15
2433
+ }
2434
+ }
2435
+
2436
+ action {
2437
+ weighted_target {
2438
+ virtual_node = aws_appmesh_virtual_node.foo.name
2439
+ weight = 100
2440
+ }
2441
+ }
2442
+ }
2443
+ }
2444
+ }
2445
+ ` , rName ))
2446
+ }
2447
+
2287
2448
func testAccRouteConfig_httpRetryPolicyUpdated (meshName , vrName , vn1Name , vn2Name , rName string ) string {
2288
2449
return acctest .ConfigCompose (testAccAppmeshRouteConfigBase (meshName , vrName , "http" , vn1Name , vn2Name ), fmt .Sprintf (`
2289
2450
resource "aws_appmesh_route" "test" {
0 commit comments