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,
|
||||
Computed: true,
|
||||
},
|
||||
"memoryReservation": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Computed: true,
|
||||
},
|
||||
"disable_networking": &schema.Schema{
|
||||
Type: schema.TypeBool,
|
||||
Computed: true,
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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))
|
||||
|
||||
|
|
|
@ -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"),
|
||||
),
|
||||
|
@ -43,6 +44,7 @@ resource "aws_ecs_task_definition" "mongo" {
|
|||
"essential": true,
|
||||
"image": "mongo:latest",
|
||||
"memory": 128,
|
||||
"memoryReservation": 64,
|
||||
"name": "mongodb"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue