Skip to content

Commit

Permalink
converting sdk ProxyConfiguration to tf configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianC committed Jun 12, 2019
1 parent d005634 commit 098e3a6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions aws/resource_aws_ecs_task_definition.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ func resourceAwsEcsTaskDefinitionRead(d *schema.ResourceData, meta interface{})
return err
}

if err := d.Set("proxy_configuration", flattenProxyConfiguration(taskDefinition.ProxyConfiguration)); err != nil {
return err
}

return nil
}

Expand All @@ -472,6 +476,28 @@ func flattenPlacementConstraints(pcs []*ecs.TaskDefinitionPlacementConstraint) [
return results
}

func flattenProxyConfiguration(pc *ecs.ProxyConfiguration) []map[string]interface{} {
if pc == nil {
return nil
}

meshProperties := make(map[string]string)
if pc.Properties != nil {
for _, prop := range pc.Properties {
meshProperties[*prop.Name] = *prop.Value
}
}

config := make(map[string]interface{})
config["container_name"] = *pc.ContainerName
config["type"] = *pc.Type
config["properties"] = meshProperties

return []map[string]interface{} {
config,
}
}

func resourceAwsEcsTaskDefinitionUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ecsconn

Expand Down

0 comments on commit 098e3a6

Please sign in to comment.