title: Docker login --password-stdin seems to be broken in PS, I can log in with password in CLI, but not with stdin
body: <p>I am new to terraform and this whole deal with docker is driving me crazy, for the past two days I have been trying to make terraform to build a docker image, tried writing it from scratch, that was awful and unintuitive so I decided to use some module Anton Babenko wrote, needless to say that did not work if I'm here.</p>
  <p>Then I tried to rewrite the whole thing for the third time but use a provisioner block with  PS commands to build and push the image, instead of relying on terraform to do so, which always seems to fail.</p>
  <pre><code>   provisioner &quot;local-exec&quot; {
        interpreter = [&quot;PowerShell&quot;, &quot;-Command&quot;]
        command     = &lt;&lt;EOF
  aws ecr get-login-password | docker login https://${local.account_id}.dkr.ecr.${local.region}.amazonaws.com/v2/ -u AWS --password-stdin 
  cd docker
  docker build -t ${local.image_name}:${local.image_tag} . 
  docker push ${local.image_name}:${local.image_tag}
  EOF
    }
  }
  </code></pre>
  <p>When i try this individually:
  (Yes, the <em><strong>my actual</strong></em> variables are only to redact personal info, the correct info is present in the actual requests)</p>
  <pre><code>aws ecr get-login-password | docker login https://*my actual account id*.dkr.ecr.*my actual region*.amazonaws.com/v2/ -u AWS --password-stdin 
  </code></pre>
  <p><strong>Output:</strong></p>
  <p><code>Error response from daemon: login attempt to https://*my actual accout id*.dkr.ecr.*my actual region*.amazonaws.com/v2/ failed with status: 400 Bad Request</code></p>
  <p>AWS ECR returns the correct password, but for whatever reason --password-stdin does NOT catch it properly, something breaks.</p>
  <p>because when i try:</p>
  <pre><code>aws ecr get-login-password | docker login https://*my actual account id*.dkr.ecr.*my actual region*.amazonaws.com/v2/ -u AWS -p *my actual pw*
  </code></pre>
  <p><strong>Output:</strong></p>
  <pre><code>WARNING! Using --password via the CLI is insecure. Use --password-stdin.
  Login Succeeded
  </code></pre>
  <p>I also tried:</p>
  <pre><code>aws ecr get-login-password &gt; pw.txt
  cat ./pw.txt | docker login -u AWS --password-stdin *my actual account id*.dkr.ecr.*my actual region*.amazonaws.com
  </code></pre>
  <p>Also returns 400.</p>
  <p>If I just put the password in the code, it seems to work and build the image, but it doesnt push it for some reason, I get an error there too.
  Docker seems to be a downward spiral of a learning experience...</p>
  <p><strong>EDIT:</strong>
  I seem to have misunderstood the use of docker login, instad of image name I should pass a repo url... silly me!</p>
  <pre><code>${local.image_name} 
  </code></pre>
  <p>Should be:</p>
  <pre><code>${aws_ecr_repository.*my repo*.repository_url}
  </code></pre>
  <p>But the --password-stdin issue persists, unfortunately.</p>
  <p><em><strong>SOLVED!</strong></em></p>