terraform-provider-ad
terraform-provider-ad copied to clipboard
Update vendored dependency github.com/masterzen/winrm/powershell.go to the latest version
Terraform Version and Provider Version
TF version: 0.14.5 Provider version: 0.4.3 (latest as of time of writing)
Expected Behavior
Non-ASCII characters (german umlauts in my case) in user attributes (first name, last name, etc.) are supported.
Actual Behavior
Non-ASCII characters in generated powershell command has broken, resulting in broken user data in AD.
Steps to Reproduce
- Enable Powershell commands logging to be able to examine commands executed by provider:
reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\Transcription" /v EnableTranscripting /t REG_DWORD /d 1 /f
reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\Transcription" /v OutputDirectory /t REG_SZ /d "C:\" /f
reg add "HKLM\Software\Policies\Microsoft\Windows\PowerShell\Transcription" /v EnableInvocationHeader /t REG_DWORD /d 1 /f
- Try to update an AD user with non-ASCII character in the name.
resource "ad_user" "user" {
...
display_name = "Max Möstermann"
given_name = "Max"
surname = "Möstermann"
...
}
- Find and open powershell transcript file with apply powershell, command in the file will be corrupted:
Set-ADUser -Identity "9ae4c1ff-b104-4422-8021-ccc0c4ac4400" -DisplayName "Max M菃숀¶stermann" -Surname "M菃숀¶stermann" ...
-
Copy contents of https://github.com/masterzen/winrm/blob/master/powershell.go into local copy of https://github.com/hashicorp/terraform-provider-ad/blob/main/vendor/github.com/masterzen/winrm/powershell.go, build provider from sources, copy it to TF plugins cache directory, etc.
-
Run plan and apply again, find and open powershell transcript file with apply powershell, command in the file will be NOT corrupted:
Set-ADUser -Identity "9ae4c1ff-b104-4422-8021-ccc0c4ac4400" -DisplayName "Max Möstermann" -Surname "Möstermann" ...
TF version: 1.0.6 Provider version: 0.4.3
I have the same problem, but with Russian characters (Cyrillic) in the title
and department
parameters