@@ -1013,6 +1013,14 @@ func TestAccECSService_BlueGreenDeployment_basic(t *testing.T) {
10131013 resource .TestCheckTypeSetElemAttrPair (resourceName , "deployment_configuration.0.lifecycle_hook.*.role_arn" , "aws_iam_role.global" , names .AttrARN ),
10141014 resource .TestCheckTypeSetElemAttr (resourceName , "deployment_configuration.0.lifecycle_hook.*.lifecycle_stages.*" , "POST_SCALE_UP" ),
10151015 resource .TestCheckTypeSetElemAttr (resourceName , "deployment_configuration.0.lifecycle_hook.*.lifecycle_stages.*" , "POST_TEST_TRAFFIC_SHIFT" ),
1016+ resource .TestCheckTypeSetElemNestedAttrs (resourceName , "deployment_configuration.0.lifecycle_hook.*" , map [string ]string {
1017+ "hook_details" : "[1,\" 2\" ,true]" ,
1018+ "lifecycle_stages.0" : "POST_SCALE_UP" ,
1019+ }),
1020+ resource .TestCheckTypeSetElemNestedAttrs (resourceName , "deployment_configuration.0.lifecycle_hook.*" , map [string ]string {
1021+ "hook_details" : "3.14" ,
1022+ "lifecycle_stages.0" : "TEST_TRAFFIC_SHIFT" ,
1023+ }),
10161024 // Load balancer advanced configuration checks
10171025 resource .TestCheckResourceAttr (resourceName , "load_balancer.0.advanced_configuration.#" , "1" ),
10181026 resource .TestCheckResourceAttrSet (resourceName , "load_balancer.0.advanced_configuration.0.alternate_target_group_arn" ),
@@ -1036,6 +1044,10 @@ func TestAccECSService_BlueGreenDeployment_basic(t *testing.T) {
10361044 // Lifecycle hooks configuration checks
10371045 resource .TestCheckResourceAttr (resourceName , "deployment_configuration.0.lifecycle_hook.#" , "1" ),
10381046 resource .TestCheckTypeSetElemAttr (resourceName , "deployment_configuration.0.lifecycle_hook.*.lifecycle_stages.*" , "PRE_SCALE_UP" ),
1047+ resource .TestCheckTypeSetElemNestedAttrs (resourceName , "deployment_configuration.0.lifecycle_hook.*" , map [string ]string {
1048+ "hook_details" : "{\" bool_key\" :true,\" int_key\" :10,\" list_key\" :[1,\" 2\" ,true],\" object_key\" :{\" bool_key\" :true,\" int_key\" :10,\" list_key\" :[1,\" 2\" ,true],\" string_key\" :\" string_val\" },\" string_key\" :\" string_val\" }" ,
1049+ "lifecycle_stages.0" : "PRE_SCALE_UP" ,
1050+ }),
10391051 // Service Connect test traffic rules checks
10401052 resource .TestCheckResourceAttr (resourceName , "service_connect_configuration.0.service.0.client_alias.0.test_traffic_rules.0.header.0.name" , "x-test-header-2" ),
10411053 resource .TestCheckResourceAttr (resourceName , "service_connect_configuration.0.service.0.client_alias.0.test_traffic_rules.0.header.0.value.0.exact" , "test-value-2" ),
@@ -1188,6 +1200,14 @@ func TestAccECSService_BlueGreenDeployment_changeStrategy(t *testing.T) {
11881200 Check : resource .ComposeTestCheckFunc (
11891201 testAccCheckServiceExists (ctx , resourceName , & service ),
11901202 resource .TestCheckResourceAttr (resourceName , "deployment_configuration.0.strategy" , "BLUE_GREEN" ),
1203+ resource .TestCheckTypeSetElemNestedAttrs (resourceName , "deployment_configuration.0.lifecycle_hook.*" , map [string ]string {
1204+ "hook_details" : acctest .CtTrue ,
1205+ "lifecycle_stages.0" : "POST_SCALE_UP" ,
1206+ }),
1207+ resource .TestCheckTypeSetElemNestedAttrs (resourceName , "deployment_configuration.0.lifecycle_hook.*" , map [string ]string {
1208+ "hook_details" : "\" Test string\" " ,
1209+ "lifecycle_stages.0" : "TEST_TRAFFIC_SHIFT" ,
1210+ }),
11911211 ),
11921212 },
11931213 {
@@ -1281,7 +1301,7 @@ func TestAccECSService_BlueGreenDeployment_waitServiceActive(t *testing.T) {
12811301 CheckDestroy : testAccCheckServiceDestroy (ctx ),
12821302 Steps : []resource.TestStep {
12831303 {
1284- Config : testAccServiceConfig_blueGreenDeployment_basic (rName , true ),
1304+ Config : testAccServiceConfig_blueGreenDeployment_basic (rName , false ),
12851305 Check : resource .ComposeTestCheckFunc (
12861306 testAccCheckServiceExists (ctx , resourceName , & service ),
12871307 resource .TestCheckResourceAttr (resourceName , "deployment_configuration.0.strategy" , "BLUE_GREEN" ),
@@ -2782,7 +2802,6 @@ func testAccCheckServiceExists(ctx context.Context, name string, service *awstyp
27822802
27832803 return nil
27842804 })
2785-
27862805 if err != nil {
27872806 return err
27882807 }
@@ -3482,12 +3501,14 @@ resource "aws_ecs_service" "test" {
34823501 hook_target_arn = aws_lambda_function.hook_success.arn
34833502 role_arn = aws_iam_role.global.arn
34843503 lifecycle_stages = ["POST_SCALE_UP", "POST_TEST_TRAFFIC_SHIFT"]
3504+ hook_details = jsonencode([1, "2", true])
34853505 }
34863506
34873507 lifecycle_hook {
34883508 hook_target_arn = aws_lambda_function.hook_success.arn
34893509 role_arn = aws_iam_role.global.arn
34903510 lifecycle_stages = ["TEST_TRAFFIC_SHIFT", "POST_PRODUCTION_TRAFFIC_SHIFT"]
3511+ hook_details = "3.14"
34913512 }
34923513 }
34933514
@@ -3723,6 +3744,12 @@ resource "aws_ecs_service" "test" {
37233744 hook_target_arn = %[2]s
37243745 role_arn = aws_iam_role.global.arn
37253746 lifecycle_stages = ["PRE_SCALE_UP"]
3747+ hook_details = jsonencode({ "bool_key" : true, "string_key" : "string_val", "int_key" : 10, "list_key" : [1, "2", true], "object_key" : {
3748+ "bool_key" : true,
3749+ "string_key" : "string_val",
3750+ "int_key" : 10,
3751+ "list_key" : [1, "2", true]
3752+ } })
37263753 }
37273754 }
37283755
@@ -3862,12 +3889,14 @@ resource "aws_ecs_service" "test" {
38623889 hook_target_arn = aws_lambda_function.hook_success.arn
38633890 role_arn = aws_iam_role.global.arn
38643891 lifecycle_stages = ["POST_SCALE_UP", "POST_TEST_TRAFFIC_SHIFT"]
3892+ hook_details = "true"
38653893 }
38663894
38673895 lifecycle_hook {
38683896 hook_target_arn = aws_lambda_function.hook_success.arn
38693897 role_arn = aws_iam_role.global.arn
38703898 lifecycle_stages = ["TEST_TRAFFIC_SHIFT", "POST_PRODUCTION_TRAFFIC_SHIFT"]
3899+ hook_details = jsonencode("Test string")
38713900 }
38723901 }
38733902
0 commit comments