Add MemoryReservation To ECS Container Definition
This commit is contained in:
parent
70cc108614
commit
c94cfd941d
|
@ -41,6 +41,10 @@ func dataSourceAwsEcsContainerDefinition() *schema.Resource {
|
||||||
Type: schema.TypeInt,
|
Type: schema.TypeInt,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
"memoryReservation": &schema.Schema{
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
"disable_networking": &schema.Schema{
|
"disable_networking": &schema.Schema{
|
||||||
Type: schema.TypeBool,
|
Type: schema.TypeBool,
|
||||||
Computed: true,
|
Computed: true,
|
||||||
|
@ -65,6 +69,7 @@ func dataSourceAwsEcsContainerDefinitionRead(d *schema.ResourceData, meta interf
|
||||||
desc, err := conn.DescribeTaskDefinition(&ecs.DescribeTaskDefinitionInput{
|
desc, err := conn.DescribeTaskDefinition(&ecs.DescribeTaskDefinitionInput{
|
||||||
TaskDefinition: aws.String(d.Get("task_definition").(string)),
|
TaskDefinition: aws.String(d.Get("task_definition").(string)),
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -83,6 +88,7 @@ func dataSourceAwsEcsContainerDefinitionRead(d *schema.ResourceData, meta interf
|
||||||
}
|
}
|
||||||
d.Set("cpu", aws.Int64Value(def.Cpu))
|
d.Set("cpu", aws.Int64Value(def.Cpu))
|
||||||
d.Set("memory", aws.Int64Value(def.Memory))
|
d.Set("memory", aws.Int64Value(def.Memory))
|
||||||
|
d.Set("memoryReservation", aws.Int64Value(def.MemoryReservation))
|
||||||
d.Set("disable_networking", aws.BoolValue(def.DisableNetworking))
|
d.Set("disable_networking", aws.BoolValue(def.DisableNetworking))
|
||||||
d.Set("docker_labels", aws.StringValueMap(def.DockerLabels))
|
d.Set("docker_labels", aws.StringValueMap(def.DockerLabels))
|
||||||
|
|
||||||
|
|
|
@ -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", "mongo:latest"),
|
||||||
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "image_digest", "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", "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", "cpu", "128"),
|
||||||
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "environment.SECRET", "KEY"),
|
resource.TestCheckResourceAttr("data.aws_ecs_container_definition.mongo", "environment.SECRET", "KEY"),
|
||||||
),
|
),
|
||||||
|
@ -43,6 +44,7 @@ resource "aws_ecs_task_definition" "mongo" {
|
||||||
"essential": true,
|
"essential": true,
|
||||||
"image": "mongo:latest",
|
"image": "mongo:latest",
|
||||||
"memory": 128,
|
"memory": 128,
|
||||||
|
"memoryReservation": 64,
|
||||||
"name": "mongodb"
|
"name": "mongodb"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue