hashicorp / packer

Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.
http://www.packer.io
Other
14.98k stars 3.33k forks source link

hcl2_upgrade doesn't properly convert `plan_info` of azure builder #12409

Open ayushtessell opened 1 year ago

ayushtessell commented 1 year ago

Community Note

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

When converting packer azure builder from json to hcl format using hcl2_upgrade command the plan_info isn't properly converted to hcl format :

            "type": "azure-arm",
            "plan_info": {
                "plan_name": "centos-stream-8-0-free",
                "plan_product": "centos-stream-8-0-free",
                "plan_publisher": "eurolinuxspzoo1620639373013"
            },

into hcl is this

  plan_info = {
    plan_name      = "centos-stream-8-0-free"
    plan_product   = "centos-stream-8-0-free"
    plan_publisher = "eurolinuxspzoo1620639373013"
  }

but instead should be this

  plan_info  {
    plan_name      = "centos-stream-8-0-free"
    plan_product   = "centos-stream-8-0-free"
    plan_publisher = "eurolinuxspzoo1620639373013"
  }

I think previously people have experienced this issue as stated here

I highly urge to please to please find a robust method for hcl2_upgrade command as I think same type of problem occurred with shared_image_gallery tag for azure

Reproduction Steps

Steps to reproduce this issue

Packer version

Packer v1.8.5

Simplified Packer Template

If the file is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

Operating system and Environment details

OS, Architecture, and any other information you can provide about the environment.

Log Fragments and crash.log files

Include appropriate log fragments. If the log is longer than a few dozen lines, please include the URL to the gist of the log or use the Github detailed format instead of posting it directly in the issue.

Set the env var PACKER_LOG=1 for maximum log detail.

E0482204 commented 10 months ago

I think I may be seeing the same thing: https://github.com/hashicorp/packer/issues/12616