Skip to content

Commit

Permalink
Use '_Values' for validations (hashicorp#14601).
Browse files Browse the repository at this point in the history
  • Loading branch information
ewbankkit committed Mar 14, 2022
1 parent de8c5b7 commit 937eca2
Showing 1 changed file with 17 additions and 35 deletions.
52 changes: 17 additions & 35 deletions internal/service/ecs/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
},
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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),
},
},
},
Expand All @@ -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,
Expand Down

0 comments on commit 937eca2

Please sign in to comment.