@@ -378,13 +378,33 @@ func TestAccECSService_CapacityProviderStrategy_basic(t *testing.T) {
378
378
Config : testAccServiceConfig_capacityProviderStrategy (rName , 1 , 0 , false ),
379
379
Check : resource .ComposeTestCheckFunc (
380
380
testAccCheckServiceExists (ctx , resourceName , & service ),
381
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.#" , "1" ),
382
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.weight" , "1" ),
383
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.base" , "0" ),
381
384
),
385
+ ConfigPlanChecks : resource.ConfigPlanChecks {
386
+ PreApply : []plancheck.PlanCheck {
387
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionCreate ),
388
+ },
389
+ },
390
+ },
391
+ {
392
+ Config : testAccServiceConfig_capacityProviderStrategy (rName , 10 , 1 , false ),
393
+ ExpectError : regexache .MustCompile (`force_new_deployment should be true when capacity_provider_strategy is being updated` ),
382
394
},
383
395
{
384
- Config : testAccServiceConfig_capacityProviderStrategy (rName , 10 , 1 , false ),
396
+ Config : testAccServiceConfig_capacityProviderStrategy (rName , 10 , 1 , true ),
385
397
Check : resource .ComposeTestCheckFunc (
386
398
testAccCheckServiceExists (ctx , resourceName , & service ),
399
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.#" , "1" ),
400
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.weight" , "10" ),
401
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.base" , "1" ),
387
402
),
403
+ ConfigPlanChecks : resource.ConfigPlanChecks {
404
+ PreApply : []plancheck.PlanCheck {
405
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionUpdate ),
406
+ },
407
+ },
388
408
},
389
409
},
390
410
})
@@ -406,6 +426,9 @@ func TestAccECSService_CapacityProviderStrategy_forceNewDeployment(t *testing.T)
406
426
Config : testAccServiceConfig_capacityProviderStrategy (rName , 1 , 0 , true ),
407
427
Check : resource .ComposeTestCheckFunc (
408
428
testAccCheckServiceExists (ctx , resourceName , & service ),
429
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.#" , "1" ),
430
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.weight" , "1" ),
431
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.base" , "0" ),
409
432
),
410
433
ConfigPlanChecks : resource.ConfigPlanChecks {
411
434
PreApply : []plancheck.PlanCheck {
@@ -417,6 +440,9 @@ func TestAccECSService_CapacityProviderStrategy_forceNewDeployment(t *testing.T)
417
440
Config : testAccServiceConfig_capacityProviderStrategy (rName , 10 , 1 , true ),
418
441
Check : resource .ComposeTestCheckFunc (
419
442
testAccCheckServiceExists (ctx , resourceName , & service ),
443
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.#" , "1" ),
444
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.weight" , "10" ),
445
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.base" , "1" ),
420
446
),
421
447
ConfigPlanChecks : resource.ConfigPlanChecks {
422
448
PreApply : []plancheck.PlanCheck {
@@ -455,17 +481,23 @@ func TestAccECSService_CapacityProviderStrategy_update(t *testing.T) {
455
481
Config : testAccServiceConfig_updateCapacityProviderStrategy (rName , 1 , "FARGATE" ),
456
482
Check : resource .ComposeTestCheckFunc (
457
483
testAccCheckServiceExists (ctx , resourceName , & service ),
484
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.#" , "1" ),
485
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.capacity_provider" , "FARGATE" ),
486
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.weight" , "1" ),
458
487
),
459
488
ConfigPlanChecks : resource.ConfigPlanChecks {
460
489
PreApply : []plancheck.PlanCheck {
461
- plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionReplace ),
490
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionUpdate ),
462
491
},
463
492
},
464
493
},
465
494
{
466
495
Config : testAccServiceConfig_updateCapacityProviderStrategy (rName , 1 , "FARGATE_SPOT" ),
467
496
Check : resource .ComposeTestCheckFunc (
468
497
testAccCheckServiceExists (ctx , resourceName , & service ),
498
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.#" , "1" ),
499
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.capacity_provider" , "FARGATE_SPOT" ),
500
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.0.weight" , "1" ),
469
501
),
470
502
ConfigPlanChecks : resource.ConfigPlanChecks {
471
503
PreApply : []plancheck.PlanCheck {
@@ -477,10 +509,11 @@ func TestAccECSService_CapacityProviderStrategy_update(t *testing.T) {
477
509
Config : testAccServiceConfig_updateCapacityProviderStrategyRemove (rName ),
478
510
Check : resource .ComposeTestCheckFunc (
479
511
testAccCheckServiceExists (ctx , resourceName , & service ),
512
+ resource .TestCheckResourceAttr (resourceName , "capacity_provider_strategy.#" , "0" ),
480
513
),
481
514
ConfigPlanChecks : resource.ConfigPlanChecks {
482
515
PreApply : []plancheck.PlanCheck {
483
- plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionReplace ),
516
+ plancheck .ExpectResourceAction (resourceName , plancheck .ResourceActionUpdate ),
484
517
},
485
518
},
486
519
},
0 commit comments