title: Cloudformation KeyValuePair List as a parameter
body: <p>When creating ECS infrastructure we describe our <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-taskdefinition.html" rel="noreferrer">Task Definitions</a> with CloudFormation. We want to be able to dynamically pass environment variables as a parameter to the template. According to the docs, <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions.html#cfn-ecs-taskdefinition-containerdefinition-environment" rel="noreferrer">Environment</a> has a <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ecs-taskdefinition-containerdefinitions-environment.html" rel="noreferrer">KeyValuePair</a> type, but CloudFormation parameters do not have this type.
  We can not hardcode Environment variables to the template, because this template is used as a nested stack so environment variables will be dynamically passed inside it.</p>
  
  <p>The only possible way I see so far is to pass all arguments as a CommaDelimitedList, and then somehow parse and map it using <a href="http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html" rel="noreferrer">CloudFormation functions</a>. I can Fn::Split every entity in key and value, but how to dynamically build an array of KeyValuePair in CloudFormation? </p>
  
  <p>Or maybe there is an easier way, and I'm missing something? Thanks in advance for any ideas.</p>