I want to use packer to build an ami.
The AMI was initially built by an aws_instance
resource in terraform. It contains the following user_data
<powershell>
winrm quickconfig -q
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="300"}'
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
netsh advfirewall firewall add rule name="WinRM 5985" protocol=TCP dir=in localport=5985 action=allow
netsh advfirewall firewall add rule name="WinRM 5986" protocol=TCP dir=in localport=5986 action=allow
net stop winrm
sc.exe config winrm start=auto
net start winrm
</powershell>
When I copy and paste this into a packer json file, packer does not like it:
$ packer build windows-2012.json
Failed to parse template: Error parsing JSON: invalid character '\n' in string literal
At line 22, column 1 (offset 560):
21: "user_data": "<powershell>
22:
How can i fix it?