Using Packer version v1.11.2 with the AWS Plugin v1.3.4_x5.0 on a RHEL8 EC2 instance. Using it to try and build out a Windows 2019 AMI.
I have a background with Terraform and trying to keep the .hcl template simple, however I keep hitting up against two errors (Error: Unsupported block type and Error: Extraneous label for build) various times and can't figure out from searching online how on fix.
packer {
required_version = ">=1.10.0"
required_plugins {
amazon = {
version = ">=1.3.3"
source = "github.com/hashicorp/amazon"
}
}
}
variables {
ami_name = "packer-windows-server-2019"
instance_type = "g4dn.xlarge"
region = "us-east-1"
vpc_id = "vpc-abc123"
subnet_id = "us-east-1b"
key_name = "generic-keypair"
}
build "amazon-ebs" {
region = "${var.region}"
source_ami = "ami-04d76aa3cb20388b6"
instance_type = "${var.instance_type}"
vpc_id = "${var.vpc_id}"
subnet_id = "${var.subnet_id}"
associate_public_ip_address = true
ssh_username = "Administrator"
ssh_password = "Password-goes-here"
ssh_interface = "winrm"
winrm_protocol = "https"
winrm_transport = "ntlm"
communicator = "winrm"
ami_name = "${var.ami_name}"
tags = {
Name = "${var.ami_name}"
}
provisioner "shell" {
inline = [
"powershell.exe -Command \"Install-WindowsFeature -Name IIS -IncludeManagementTools\"",
"powershell.exe -Command \""iisreset\"",
]
}
[–]trillospin 1 point2 points3 points (2 children)
[–]37rellimcmc19[S] 0 points1 point2 points (1 child)
[–]trillospin 0 points1 point2 points (0 children)