outscale / packer-plugin-outscale

Packer plugin for Outscale OMI Builder
https://www.packer.io/docs/builders/outscale
Mozilla Public License 2.0
7 stars 13 forks source link

Neither clean_resource_name or clean_omi_name functions are working #167

Open gamcorn opened 1 year ago

gamcorn commented 1 year ago

Overview of the Issue

In OSC provider version 1.1.3 when using omi name automatic reformatting functions as specified on packer docs: mybuild-{{isotime | clean_resource_name}}" will become mybuild-2017-10-18t02-06-30z will raise an error: function "clean_resource_name" not defined Replacing clean_resource_name by the Outscale plugin recommended clean_omi_name raises an error: function "clean_omi_name" not defined.

Reproduction Steps

Create a packer configuration with the OSC provider version 1.1.3 Setup timestamp naming on the image name with: omi_name = "$my-base-name-{{isotime | clean_resource_name}}" Use command 'packer validate .' to validate your build This will rise an error

Now try with omi_name = "$my-base-name-{{isotime | clean_omi_name}}" Use command 'packer validate .' to validate your build This will rise an error

Plugin and Packer version

From packer version 1.9.4

Simplified Packer Buildfile

packer {
  required_plugins {
    outscale = {
      version = ">=v1.1.3"
      source  = "github.com/outscale/outscale"
    }
  }
}

source "outscale-bsu" "my_image" {
    launch_block_device_mappings {
        delete_on_vm_deletion = true
        device_name = "/dev/xvdf"
    }
    source_omi_filter {
        filters = {
            image-name          = "Ubuntu-20.04-2021.02.10-5"
            root-device-type    = "ebs"
            virtualization-type = "hvm"
        }
        owners = ["Outscale"]
        most_recent = true
    }
    source_omi = "${var.omi}"
}

build {
  name = "worker_image"
  source "source.outscale-bsu.quetzal" {
    omi_name = "worker-{{isotime | clean_resource_name}}"
  }
}

Operating system and Environment details

CENTOS 7 Outscale VM

Log Fragments and crash.log files

Error: invalid 'omi_name': template: root:1: function "clean_resource_name" not defined in:

worker-{{isotime | clean_resource_name}}

  on packer/quetzal_img.pkr.hcl line 28:
  (source code not available)
Error: invalid 'omi_name': template: root:1: function "clean_omi_name" not defined in:

worker-{{isotime | clean_omi_name}}

  on packer/quetzal_img.pkr.hcl line 28:
  (source code not available)

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