我在本地系统中创建了一个packer json模板,并安装了packer 1.7.7。然后我升级到了hcl2模板。但是,当我尝试在具有packer版本1.6.1的jenkins节点上运行packer管道时。它给我一个bwloe错误
Blocks of type "data" are not expected here.
Error: Unsupported block type经过研究,我意识到包装器版本1.6.1不支持其模板中的数据块,但支持hcl2模板,谁能建议我如何用包装器1中支持的东西替换下面模板中的数据块。
data "amazon-ami" "autogenerated_1"{
access_key = "${var.aws_access_key}"
filters = {
root-device-type = "ebs"
virtualization-type = "hvm"
name = "**** Linux *"
}
most_recent = true
region = "${var.aws_region}"
owners = ["${var.owner_id}"]
secret_key = "${var.aws_secret_key}"
}
when I am trying to consume this ami id in the source block It gives me error.
ami_name = "${var.ami_name}"
associate_public_ip_address = false
force_deregister = true
iam_instance_profile = "abc"
instance_type = "****"
region = "${var.aws_region}"
source_ami = data.amazon-ami.autogenerated_1.id
ssh_interface = "private_ip"
ssh_username = "user"
subnet_id = "subnet-********"
vpc_id = "vpc-***********"
}发布于 2021-11-06 08:46:33
https://stackoverflow.com/questions/69861082
复制相似问题