{
  "builders": [
    {
      "access_key": "{{user `aws_access_key`}}",
      "ami_description": "{{user `ami_description`}}",
      "ami_groups": "{{user `ami_groups`}}",
      "ami_name": "capa-ami-{{user `build_name`}}-{{user `kubernetes_semver` | clean_resource_name}}-{{user `build_timestamp`}}",
      "ami_product_codes": "",
      "ami_regions": "{{user `ami_regions`}}",
      "ami_users": "{{user `ami_users`}}",
      "associate_public_ip_address": true,
      "communicator": "winrm",
      "disable_stop_instance": true,
      "encrypt_boot": "{{user `encrypted`}}",
      "iam_instance_profile": "{{user `iam_instance_profile`}}",
      "instance_type": "{{user `builder_instance_type`}}",
      "kms_key_id": "{{user `kms_key_id`}}",
      "launch_block_device_mappings": [
        {
          "delete_on_termination": true,
          "device_name": "{{ user `root_device_name` }}",
          "throughput": "{{ user `throughput` }}",
          "volume_size": "{{ user `volume_size` }}",
          "volume_type": "{{ user `volume_type` }}"
        }
      ],
      "name": "{{user `build_name`}}",
      "profile": "{{ user `aws_profile`}}",
      "region": "{{ user `aws_region` }}",
      "secret_key": "{{user `aws_secret_key`}}",
      "security_group_ids": "{{user `aws_security_group_ids`}}",
      "skip_create_ami": "{{ user `skip_create_ami`}}",
      "skip_profile_validation": "{{user `skip_profile_validation`}}",
      "snapshot_groups": "{{user `snapshot_groups`}}",
      "snapshot_users": "{{user `snapshot_users`}}",
      "source_ami": "{{user `source_ami`}}",
      "source_ami_filter": {
        "filters": {
          "architecture": "x86_64",
          "name": "{{user `ami_filter_name`}}",
          "root-device-type": "ebs",
          "virtualization-type": "hvm"
        },
        "most_recent": true,
        "owners": "{{user `ami_filter_owners`}}"
      },
      "ssh_keypair_name": "{{user `ssh_keypair_name`}}",
      "ssh_private_key_file": "{{user `ssh_private_key_file`}}",
      "subnet_id": "{{ user `subnet_id` }}",
      "tags": {
        "build_date": "{{isotime}}",
        "build_timestamp": "{{user `build_timestamp`}}",
        "containerd_version": "{{user `containerd_version`}}",
        "distribution": "{{user `distribution`}}",
        "distribution_version": "{{user `distribution_version`}}",
        "image_builder_version": "{{user `ib_version`}}",
        "kubernetes_cni_version": "{{user `kubernetes_cni_semver`}}",
        "kubernetes_version": "{{user `kubernetes_semver`}}",
        "source_ami": "{{user `source_ami`}}"
      },
      "temporary_security_group_source_cidrs": "{{ user `temporary_security_group_source_cidrs` }}",
      "token": "{{ user `aws_session_token` }}",
      "type": "amazon-ebs",
      "user_data_file": "packer/ami/scripts/winrm_bootstrap.txt",
      "vpc_id": "{{ user `vpc_id` }}",
      "winrm_insecure": true,
      "winrm_timeout": "6m",
      "winrm_use_ssl": true,
      "winrm_username": "Administrator"
    }
  ],
  "post-processors": [
    {
      "custom_data": {
        "containerd_version": "{{user `containerd_version`}}",
        "kubernetes_cni_version": "{{user `kubernetes_cni_semver`}}",
        "kubernetes_version": "{{user `kubernetes_semver`}}"
      },
      "output": "{{user `manifest_output`}}",
      "type": "manifest"
    }
  ],
  "provisioners": [
    {
      "extra_arguments": [
        "-e",
        "ansible_winrm_server_cert_validation=ignore",
        "--extra-vars",
        "{{user `ansible_common_vars`}}",
        "--extra-vars",
        "{{user `ansible_extra_vars`}}",
        "--extra-vars",
        "{{user `ansible_user_vars`}}"
      ],
      "playbook_file": "ansible/windows/node_windows.yml",
      "type": "ansible",
      "use_proxy": false,
      "user": "Administrator"
    },
    {
      "restart_timeout": "10m",
      "type": "windows-restart"
    },
    {
      "arch": "{{user `goss_arch`}}",
      "download_path": "{{user `goss_download_path`}}",
      "format": "{{user `goss_format`}}",
      "format_options": "{{user `goss_format_options`}}",
      "goss_file": "{{user `goss_entry_file`}}",
      "inspect": "{{user `goss_inspect_mode`}}",
      "remote_folder": "{{user `goss_remote_folder`}}",
      "remote_path": "{{user `goss_remote_path`}}",
      "skip_install": "{{user `goss_skip_install`}}",
      "target_os": "Windows",
      "tests": [
        "{{user `goss_tests_dir`}}"
      ],
      "type": "goss",
      "url": "{{user `goss_url`}}",
      "use_sudo": false,
      "vars_env": {
        "GOSS_MAX_CONCURRENT": "1",
        "GOSS_USE_ALPHA": "1"
      },
      "vars_file": "{{user `goss_vars_file`}}",
      "vars_inline": {
        "OS": "{{user `distribution` | lower}}",
        "PROVIDER": "amazon",
        "containerd_version": "{{user `containerd_version`}}",
        "distribution_version": "{{user `distribution_version`}}",
        "docker_ee_version": "{{user `docker_ee_version`}}",
        "kubernetes_version": "{{user `kubernetes_semver`}}",
        "pause_image": "{{user `pause_image`}}",
        "runtime": "{{user `runtime`}}",
        "ssh_source_url": "{{user `ssh_source_url`}}"
      },
      "version": "{{user `goss_version`}}"
    },
    {
      "inline": [
        "rm -Force -Recurse C:\\var\\log\\kubelet\\*"
      ],
      "type": "powershell"
    },
    {
      "elevated_password": "{{.WinRMPassword}}",
      "elevated_user": "Administrator",
      "script": "packer/ami/scripts/sysprep_prerequisites.ps1",
      "type": "powershell"
    },
    {
      "inline": [
        "C:/ProgramData/Amazon/EC2-Windows/Launch/Scripts/SysprepInstance.ps1"
      ],
      "type": "powershell"
    }
  ],
  "variables": {
    "additional_debug_files": null,
    "ami_description": "Cluster API base image designed for {{user `kubernetes_semver`}}",
    "ami_groups": "all",
    "ami_regions": "ap-south-1,eu-west-3,eu-west-2,eu-west-1,ap-northeast-2,ap-northeast-1,sa-east-1,ca-central-1,ap-southeast-1,ap-southeast-2,eu-central-1,us-east-1,us-east-2,us-west-1,us-west-2",
    "ami_users": "",
    "ansible_common_vars": "",
    "ansible_extra_vars": "",
    "ansible_user_vars": "",
    "aws_access_key": "",
    "aws_profile": "",
    "aws_region": "us-east-1",
    "aws_secret_key": "",
    "aws_security_group_ids": "",
    "aws_session_token": "",
    "build_name": null,
    "build_timestamp": "{{timestamp}}",
    "builder_instance_type": "t3.large",
    "cloudbase_init_url": "https://github.com/cloudbase/cloudbase-init/releases/download/{{user `cloudbase_init_version`}}/CloudbaseInitSetup_{{user `cloudbase_init_version` | replace_all `.` `_` }}_x64.msi",
    "cloudbase_metadata_services": "cloudbaseinit.metadata.services.ec2service.EC2Service",
    "cloudbase_metadata_services_unattend": "cloudbaseinit.metadata.services.base.EmptyMetadataService",
    "cloudbase_plugins": "cloudbaseinit.plugins.windows.createuser.CreateUserPlugin, cloudbaseinit.plugins.common.setuserpassword.SetUserPasswordPlugin, cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin, cloudbaseinit.plugins.common.ephemeraldisk.EphemeralDiskPlugin, cloudbaseinit.plugins.common.mtu.MTUPlugin, cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin, cloudbaseinit.plugins.common.sshpublickeys.SetUserSSHPublicKeysPlugin",
    "cloudbase_plugins_unattend": "cloudbaseinit.plugins.common.mtu.MTUPlugin",
    "containerd_sha256": null,
    "containerd_url": "",
    "containerd_version": null,
    "encrypted": "false",
    "iam_instance_profile": "",
    "ib_version": "{{env `IB_VERSION`}}",
    "kms_key_id": "",
    "kubernetes_base_url": "https://kubernetesreleases.blob.core.windows.net/kubernetes/{{user `kubernetes_semver`}}/binaries/node/windows/{{user `kubernetes_goarch`}}",
    "manifest_output": "manifest.json",
    "nssm_url": null,
    "prepull": null,
    "skip_create_ami": "false",
    "skip_profile_validation": "false",
    "snapshot_groups": "all",
    "snapshot_users": "",
    "ssh_keypair_name": "",
    "ssh_private_key_file": "",
    "subnet_id": "",
    "temporary_security_group_source_cidrs": "",
    "throughput": "125",
    "volume_size": "40",
    "volume_type": "gp3",
    "vpc_id": "",
    "windows_service_manager": null,
    "windows_updates_kbs": null,
    "wins_url": "https://github.com/rancher/wins/releases/download/v{{user `wins_version`}}/wins.exe"
  }
}