'AWS Image builder does not create C:\temp folder

I have a terraform aws_imagebuilder_component component which creates several directories:

resource "aws_imagebuilder_component" "install_services" {
  data        = <<-EOT
            phases:
            - name: build
              steps:
              - action: ExecutePowerShell
                inputs:
                  commands:
                    - New-Item -Path 'C:\Downloads\services' -ItemType Directory
                    - New-Item -Path 'C:\Downloads\service_install_scripts' -ItemType Directory
                    - New-Item -Path 'C:\temp' -ItemType Directory
                    - New-Item -Path 'C:\services' -ItemType Directory
                    - New-Item -Path 'C:\georgiTemp' -ItemType Directory
                name: create-needed-folders
              - other steps here...
            "schemaVersion": 1
        EOT
  name        = "install-services"
  description = "Installs needed services"
  platform    = "Windows"
  version     = "0.0.16"
}

The image builds successfully with the above component. However, when I use the image on a EC2 instance, the C:\temp folder does not exist. The rest of the above locations do exist.

What am I missing here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source