From 937eca2c3c2a2c65b2f7dba5d6456a10e821222b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 14 Mar 2022 09:43:47 -0400 Subject: [PATCH] Use '_Values' for validations (#14601). --- internal/service/ecs/service.go | 52 +++++++++++---------------------- 1 file changed, 17 insertions(+), 35 deletions(-) diff --git a/internal/service/ecs/service.go b/internal/service/ecs/service.go index 7b83463c0d4..35bd263ce0a 100644 --- a/internal/service/ecs/service.go +++ b/internal/service/ecs/service.go @@ -107,15 +107,11 @@ func ResourceService() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "type": { - Type: schema.TypeString, - ForceNew: true, - Optional: true, - Default: ecs.DeploymentControllerTypeEcs, - ValidateFunc: validation.StringInSlice([]string{ - ecs.DeploymentControllerTypeCodeDeploy, - ecs.DeploymentControllerTypeEcs, - ecs.DeploymentControllerTypeExternal, - }, false), + Type: schema.TypeString, + ForceNew: true, + Optional: true, + Default: ecs.DeploymentControllerTypeEcs, + ValidateFunc: validation.StringInSlice(ecs.DeploymentControllerType_Values(), false), }, }, }, @@ -253,13 +249,9 @@ func ResourceService() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - ecs.PlacementStrategyTypeBinpack, - ecs.PlacementStrategyTypeRandom, - ecs.PlacementStrategyTypeSpread, - }, false), + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(ecs.PlacementStrategyType_Values(), false), }, "field": { Type: schema.TypeString, @@ -289,12 +281,9 @@ func ResourceService() *schema.Resource { Optional: true, }, "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - ecs.PlacementConstraintTypeDistinctInstance, - ecs.PlacementConstraintTypeMemberOf, - }, false), + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(ecs.PlacementConstraintType_Values(), false), }, }, }, @@ -313,21 +302,14 @@ func ResourceService() *schema.Resource { } return false }, - ValidateFunc: validation.StringInSlice([]string{ - ecs.PropagateTagsService, - ecs.PropagateTagsTaskDefinition, - ecs.PropagateTagsNone, - }, false), + ValidateFunc: validation.StringInSlice(ecs.PropagateTags_Values(), false), }, "scheduling_strategy": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Default: ecs.SchedulingStrategyReplica, - ValidateFunc: validation.StringInSlice([]string{ - ecs.SchedulingStrategyDaemon, - ecs.SchedulingStrategyReplica, - }, false), + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Default: ecs.SchedulingStrategyReplica, + ValidateFunc: validation.StringInSlice(ecs.SchedulingStrategy_Values(), false), }, "service_registries": { Type: schema.TypeList,