I believe the sysprepping is what causes the user data script to be
scheduled in spite of the run:
https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html#user-data-execution

I don't know why you can't override the user data from the original run
though. Their documentation seems really lacking here.

On Mon, May 18, 2020 at 4:17 PM mxmxx <[email protected]> wrote:

> Packer Version: 1.5.6
> Platform: AWS (EC2)
> OS: Windows 1903
>
> Hi -
>
> I'm building Windows 1903 AMIs using Packer 1.5.6.
>
> I originally ran into the dreaded "Waiting for WinRM to become
> available.." error, but found that most docs suggested adding a user data
> script to enable/configure WinRM on the Packer Build instance. That worked
> fine.
>
> Because it's Windows, as part of my Packer provisioning,  I then run the
> EC2 Launch scripts to:
>
> 1. Initialize the instance so that User Data will run when the AMI is
> booted.
>
> 2. Sysprep the instance.
>
> That all seems to work fine.
>
> However, now my issue is that when I create a new EC2 instance off of my
> Packer AMI, the user data runs the WinRM config from my original Packer
> instance.
>
> This was confirmed by checking 
> C:\ProgramData\Amazon\EC2-Windows\Launch\Log\UserdataExecution.log
> on a child instance created from the Packer AMI
>
>  I cannot specify a new user data script to work with my custom AMI
> because of this; my new user data is ignored and the original WinRM user
> data script is executed instead.
>
> I'm assuming this is because it was sysprepped into the AMI. Is this the
> intended behavior or is there a workaround for this?
>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/hashicorp/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/dcecd1fa-bf62-40b5-a6e1-9d3a928e14f4%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/dcecd1fa-bf62-40b5-a6e1-9d3a928e14f4%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CAGPV1uqS%2BfK6dZB%2BmOr%3Dm1UOWu9-TP8wcmHrgSWTUZRa%3DwLZXg%40mail.gmail.com.

Reply via email to