Merge branch 'aws_ecs_container_definition_memory_reservation' of https://github.com/optimisticanshul/terraform into optimisticanshul-aws_ecs_container_definition_memory_reservation

This commit is contained in:
stack72 2016-08-25 17:51:38 +01:00
commit 7a852dacf2
No known key found for this signature in database
GPG Key ID: 8619A619B085CB16
2 changed files with 8 additions and 0 deletions

View File

@ -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))

View File

@ -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"
} }
] ]