Skip to content

Commit

Permalink
Add MemoryReservation To ECS Container Definition
Browse files Browse the repository at this point in the history
  • Loading branch information
sharmaansh21 authored and Richard Bowden committed Aug 27, 2016
1 parent d75dbf2 commit 3ec33cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func dataSourceAwsEcsContainerDefinition() *schema.Resource {
Type: schema.TypeInt,
Computed: true,
},
"memoryReservation": &schema.Schema{
Type: schema.TypeInt,
Computed: true,
},
"disable_networking": &schema.Schema{
Type: schema.TypeBool,
Computed: true,
Expand All @@ -65,6 +69,7 @@ func dataSourceAwsEcsContainerDefinitionRead(d *schema.ResourceData, meta interf
desc, err := conn.DescribeTaskDefinition(&ecs.DescribeTaskDefinitionInput{
TaskDefinition: aws.String(d.Get("task_definition").(string)),
})

if err != nil {
return err
}
Expand All @@ -83,6 +88,7 @@ func dataSourceAwsEcsContainerDefinitionRead(d *schema.ResourceData, meta interf
}
d.Set("cpu", aws.Int64Value(def.Cpu))
d.Set("memory", aws.Int64Value(def.Memory))
d.Set("memoryReservation", aws.Int64Value(def.MemoryReservation))
d.Set("disable_networking", aws.BoolValue(def.DisableNetworking))
d.Set("docker_labels", aws.StringValueMap(def.DockerLabels))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestAccAWSEcsDataSource_ecsContainerDefinition(t *testing.T) {
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "image", "mongo:latest"),
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "image_digest", "latest"),
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "memory", "128"),
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "memoryReservation", "64"),
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "cpu", "128"),
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "environment.SECRET", "KEY"),
),
Expand All @@ -43,6 +44,7 @@ resource "aws_ecs_task_definition" "mongo" {
"essential": true,
"image": "mongo:latest",
"memory": 128,
"memoryReservation": 64,
"name": "mongodb"
}
]
Expand Down

0 comments on commit 3ec33cc

Please sign in to comment.