title: apache_beam.io.WriteToText() name of file as template parameter
body: <p>I have a apache_beam template executed on DataFlow. I need to pass the name of a file to be written to as a template parameter. Something like</p>
  <pre><code>gcloud dataflow jobs run JOB_NAME \
      --gcs-location gs://YOUR_BUCKET_NAME/templates/MyTemplate \
      --parameters output_file_name=OUTPUT_NAME , input_file_name=INPUT_NAME 
  </code></pre>
  <p>The value of <code>output_file</code> can be accessed through PipelineOptions something like</p>
  <pre><code>class MyOptions(PipelineOptions):
  @classmethod
  def _add_argparse_args(cls,parser):
      parser.add_value_provider_argument('--output_file_name', type=str,
            help='Output Name')
      parser.add_value_provider_argument('--input_file_name', type=str,
            help='Input Name')
      
  </code></pre>
  <p>If I need to use the <code>output_name</code> in a <code>apache_beam.io.WriteToText</code> something like this</p>
  <pre><code>   optlist=PipelineOptions()
      my_options=optlist.view_as(MyOptions)
      p = apache_beam.Pipeline(options=optlist)
      (p
      | 'create'            &gt;&gt; apache_beam.Create([&quot;1&quot;,&quot;2&quot;,&quot;3&quot;])
      | beam.io.WriteToText(my_options.output_file_name.get())
  
      )
      p.run()
  </code></pre>
  <p>it is not allowed as we can read <code>my_options.output_name.get()</code> only as a runtime value and an error would be thrown, <strong>if we attempt to deployed this code as a template.</strong></p>
  <p>Considering this is a very common use-case I assume there may be a common library or solution to this. Does anybody have a work around?</p>