hashicorp / packer-plugin-amazon

Packer plugin for Amazon AMI Builder
https://www.packer.io/docs/builders/amazon
Mozilla Public License 2.0
69 stars 104 forks source link

ebssurrogate builder missing `deprecate_at` argument #478

Closed lorengordon closed 1 month ago

lorengordon commented 2 months ago

Overview of the Issue

The amazon-ebssurrogate builder is missing the deprecate_at argument.

Reproduction Steps

Attempt to use the argument deprecate_at in a template with the ebssurrogate builder.

Plugin and Packer version

❯ packer plugins installed
/home/x/.config/packer/plugins/github.com/hashicorp/amazon/packer-plugin-amazon_v1.3.2_x5.0_linux_amd64

Simplified Packer Buildfile

Just copying from the docs example, and adding the deprecate_at input...

source "amazon-ebssurrogate" "basic-example" {
  region = "us-east-1"
  ssh_username = "ubuntu"
  instance_type = "t2.medium"
  source_ami = "ami-40d28157"
  ami_name = "packer-test-ami"
  ami_virtualization_type = "paravirtual"

  deprecate_at = timeadd(timestamp(), "8760h")

  launch_block_device_mappings {
      volume_type = "gp2"
      device_name = "/dev/xvdf"
      delete_on_termination = false
      volume_size = 10
  }

  ami_root_device {
    source_device_name = "/dev/xvdf"
    device_name = "/dev/xvda"
    delete_on_termination = true
    volume_size = 16
    volume_type = "gp2"
  }
}

build {
  sources = ["sources.amazon-ebssurrogate.basic-example"]

  provisioner "shell" {
      inline = ["..."]
  }
}

Log Fragments and crash.log files

❯ packer build build.pkr.hcl
Error: Unsupported argument

  on build.pkr.hcl line 9:
  (source code not available)

An argument named "deprecate_at" is not expected here.
lbajolet-hashicorp commented 1 month ago

Hey @lorengordon,

Thanks for reporting this! The deprecate_ami attribute should have been common from the get-go, not sure why it wasn't in the first place, but if you are willing to, might I ask you to test it quickly from the PR I opened? I have pushed an acceptance test so it should be verified for ebs/ebssurrogate, but it cannot hurt to test on a real config if you are available for this :)

Thanks again!

lorengordon commented 1 month ago

Hey @lorengordon,

Thanks for reporting this! The deprecate_ami attribute should have been common from the get-go, not sure why it wasn't in the first place, but if you are willing to, might I ask you to test it quickly from the PR I opened? I have pushed an acceptance test so it should be verified for ebs/ebssurrogate, but it cannot hurt to test on a real config if you are available for this :)

Thanks again!

On vacation until next week, so can't try just yet. But will try as soon as I can! Thanks @lbajolet-hashicorp !

lbajolet-hashicorp commented 1 month ago

Thank you for the quick update, no rush, enjoy your vacation! :)