Skip to content

Commit

Permalink
Merge pull request #7790 from terraform-providers/b-aws_ecs_service-p…
Browse files Browse the repository at this point in the history
…lacement_strategy-computed

resource/aws_ecs_service: Ensure placement_strategy removal in version 2.0.0 does not force recreation
  • Loading branch information
bflad committed Mar 3, 2019
2 parents 3ed1363 + b782d72 commit c7e9331
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions aws/resource_aws_ecs_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,40 +210,24 @@ func resourceAwsEcsService() *schema.Resource {
"placement_strategy": {
Type: schema.TypeSet,
Optional: true,
ForceNew: true,
Computed: true,
MaxItems: 5,
Removed: "Use `ordered_placement_strategy` configuration block(s) instead",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"type": {
Type: schema.TypeString,
ForceNew: true,
Required: true,
},
"field": {
Type: schema.TypeString,
ForceNew: true,
Optional: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
return strings.EqualFold(old, new)
},
},
},
},
Set: func(v interface{}) int {
var buf bytes.Buffer
m := v.(map[string]interface{})
buf.WriteString(fmt.Sprintf("%s-", m["type"].(string)))
if m["field"] != nil {
field := m["field"].(string)
if field == "host" {
buf.WriteString("instanceId-")
} else {
buf.WriteString(fmt.Sprintf("%s-", field))
}
}
return hashcode.String(buf.String())
},
},
"ordered_placement_strategy": {
Type: schema.TypeList,
Expand Down

0 comments on commit c7e9331

Please sign in to comment.