From 7e9bfda31aa5c28508a97e2fe043501e852401ee Mon Sep 17 00:00:00 2001 From: clint shryock Date: Tue, 31 Jan 2017 11:31:16 -0600 Subject: [PATCH] provider/aws: Fix issue with ECS Placement Strat. and type casing The API asks you to send lower case values, but returns uppercase ones. Here we lowercase the returned API values. There is no migration here because the field in question is nested in a set, so the hash will change regardless. Anyone using this feature now has it broken anyway. --- builtin/providers/aws/resource_aws_ecs_service.go | 2 +- builtin/providers/aws/resource_aws_ecs_service_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_ecs_service.go b/builtin/providers/aws/resource_aws_ecs_service.go index 842deb4da..ef1ea1846 100644 --- a/builtin/providers/aws/resource_aws_ecs_service.go +++ b/builtin/providers/aws/resource_aws_ecs_service.go @@ -357,7 +357,7 @@ func flattenPlacementStrategy(pss []*ecs.PlacementStrategy) []map[string]interfa for _, ps := range pss { c := make(map[string]interface{}) c["type"] = *ps.Type - c["field"] = *ps.Field + c["field"] = strings.ToLower(*ps.Field) results = append(results, c) } return results diff --git a/builtin/providers/aws/resource_aws_ecs_service_test.go b/builtin/providers/aws/resource_aws_ecs_service_test.go index 3c1bd2b29..dab45018a 100644 --- a/builtin/providers/aws/resource_aws_ecs_service_test.go +++ b/builtin/providers/aws/resource_aws_ecs_service_test.go @@ -445,7 +445,7 @@ resource "aws_ecs_service" "mongo" { desired_count = 1 placement_strategy { type = "binpack" - field = "MEMORY" + field = "memory" } } `