title: Read remote file or access Powershell output with Terraform
body: <p>Sorry if this has been answered.  I have been unable to find someone doing the same thing.  I have a Terraform module that builds an Azure VM.  I have a resource for <code>virtual_machine_extension</code> that runs a Powershell script to do some pre and post build items.  The Powershell script is run from an Azure Blob.  The main output from this script is a text file created.  I am trying to find a way to read that text file and use the contents in Terraform in another resource as a parameter.</p>
  
  <p>I have created a Powershell variable that holds the contents of the file as well but I have the same issue as with the text file.  Not sure how to get the contents out of that variable into a parameter that Terraform can understand.</p>
  
  <p>I am open to whatever way this can be achieved.</p>
  
  <p>Also, I am running TF 12.20.</p>
  
  <p>EDIT: Sorry all.  Let me provide a little more information.  So I Need to get the content on a remote server that is being built with Terraform.  My virtual machine extension runs a powershell script that creates a file locally on the server being built.  I need to take the content from that file and pass it into a null resource.  </p>
  
  <p>So let's say the content of the file on the remote server is "Testing data".</p>
  
  <p>I will need to pass that content to a winrm connection.</p>
  
  <pre><code>    resource "null_resource" "chef-client" {
        triggers = {
          build_number = "${timestamp()}"
        }
        provisioner "chef" {
          connection {
            type = "winrm"
            user = var.user
            password = var.password
            host = var.host
            cacert = &lt;text content&gt;
            timeout = "5m"
            port = 5986
            use_ntlm = false
            https = true
            insecure = false
         }
       }
     }
  </code></pre>
  
  <p>Updated the entire connection piece that I am trying to get working.  The server is not part of the domain at this point.  I tried <code>local_file</code> data source but could not auto-auth because it isn't part of the domain.  Been looking at <code>template_file</code> and <code>external</code> data source but not sure if that is the best way if you can somehow pull the result out of powershell for TF to read.</p>