hashicorp / hashicorp/packer-plugin-oracle

Error: Unsupported argument for base_image_filter in oracle-oci

Open
#101 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
14
Forks
16
PR merge metrics
No merged PRs in 30d

Description

#### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

#### Overview of the Issue

According to https://developer.hashicorp.com/packer/integrations/hashicorp/oracle/latest/components/builder/oci#required-configuration-parameters base_image_filter string map can be used instead of base_image_ocid. However, doing this change results in below error.

```
$ packer validate -var-file="ms-oci-ol9-builder.pkrvars.hcl" ms-oci-ol9-builder.pkr.hcl
_Error: Unsupported argument

on ms-oci-ol9-builder.pkr.hcl line 30:
(source code not available)

An argument named "base_image_filter" is not expected here. Did you mean to
define a block of type "base_image_filter"?_
```

#### Reproduction Steps

Create packer file as below (some items redacted)

```
packer {
required_plugins {
oracle = {
version = ">= 1.0.4"
source = "github.com/hashicorp/oracle"
}
}
}

locals {
date_suffix = formatdate("YYYY-MM-DD", timestamp())
}

variable "os_shortname" {
type = string
}

variable "disk_size" {
type = number
default = 50
}

variable "repo_name" {
type = string
}

source "oracle-oci" "ms-oci-builder" {
availability_domain = "oxNh:US-ASHBURN-AD-1"
#base_image_ocid = "ocid1.image.oc1.iad.aaaaaaaa66oholjcnzscadxglrabahc5ygsjp5f764eofwdbivsz5zxyl2ja"
base_image_filter = {
"operating_system" = "Oracle Linux"
"operating_system_version" = "9.2"
"display_name_search" = "^Oracle-Linux-9.[0-9]-[0-9]+"
}
compartment_ocid = "ocid1.compartment.oc1................"
instance_name = "ms-oci-${var.os_shortname}-builder"
instance_tags = {
"deployed_by" = "ms_az_devops"
"reason" = "temporary image build environment"
}
disk_size = var.disk_size
image_compartment_ocid = "ocid1.compartment.oc1................................"
image_name = "ms-oci-${var.os_shortname}-${local.date_suffix}"
tags = {
"deployed_by" = "ms_az_devops"
"repo_name" = var.repo_name
}
shape = "VM.Standard1.1"
ssh_username = "opc"
subnet_ocid = "ocid1.subnet.oc1..........................."
key_file = "oci.pem"
use_private_ip = true
}

build {
name = "ms-oci-ol9-buider"
sources = ["source.oracle-oci.ms-oci-builder"]
}
```

with proper var file (not shown), run either of the below commands.

packer validate -var-file="ms-oci-ol9-builder.pkrvars.hcl" ms-oci-ol9-builder.pkr.hcl
packer build -var-file="ms-oci-ol9-builder.pkrvars.hcl" ms-oci-ol9-builder.pkr.hcl

### Packer version

Packer v1.9.4

### Operating system and Environment details

ubuntu 22.04 LTS on WSL

### Log Fragments and crash.log files

```
2023/09/04 09:31:13 [TRACE] listing potential installations for "github.com/hashicorp/oracle" that match ">= 1.0.4". plugingetter.ListInstallationsOptions{FromFolders:[]string{"/home/lmpeiris/bin", ".", "/home/lmpeiris/.config/packer/plugins"}, BinaryInstallationOptions:plugingetter.BinaryInstallationOptions{APIVersionMajor:"5", APIVersionMinor:"0", OS:"linux", ARCH:"amd64", Ext:"", Checksummers:[]plugingetter.Checksummer{plugingetter.Checksummer{Type:"sha256", Hash:(*sha256.digest)(0xc0005ec000)}}}}
2023/09/04 09:31:13 [TRACE] Found the following "github.com/hashicorp/oracle" installations: [{/home/lmpeiris/.config/packer/plugins/github.com/hashicorp/oracle/packer-plugin-oracle_v1.0.4_x5.0_linux_amd64 v1.0.4}]
2023/09/04 09:31:13 [INFO] found external [classic oci] builders from oracle plugin
2023/09/04 09:31:13 [TRACE] validateValue: not active for os_shortname, so skipping
2023/09/04 09:31:13 [TRACE] validateValue: not active for disk_size, so skipping
2023/09/04 09:31:13 [TRACE] validateValue: not active for repo_name, so skipping
2023/09/04 09:31:13 [INFO] Starting external plugin /home/lmpeiris/.config/packer/plugins/github.com/hashicorp/oracle/packer-plugin-oracle_v1.0.4_x5.0_linux_amd64 start builder oci
2023/09/04 09:31:13 Starting plugin: /home/lmpeiris/.config/packer/plugins/github.com/hashicorp/oracle/packer-plugin-oracle_v1.0.4_x5.0_linux_amd64 []string{"/home/lmpeiris/.config/packer/plugins/github.com/hashicorp/oracle/packer-plugin-oracle_v1.0.4_x5.0_linux_amd64", "start", "builder", "oci"}
2023/09/04 09:31:13 Waiting for RPC address for: /home/lmpeiris/.config/packer/plugins/github.com/hashicorp/oracle/packer-plugin-oracle_v1.0.4_x5.0_linux_amd64
2023/09/04 09:31:13 packer-plugin-oracle_v1.0.4_x5.0_linux_amd64 plugin: 2023/09/04 09:31:13 Plugin address: unix /tmp/packer-plugin395928238
2023/09/04 09:31:13 packer-plugin-oracle_v1.0.4_x5.0_linux_amd64 plugin: 2023/09/04 09:31:13 Waiting for connection...
2023/09/04 09:31:13 Received unix RPC address for /home/lmpeiris/.config/packer/plugins/github.com/hashicorp/oracle/packer-plugin-oracle_v1.0.4_x5.0_linux_amd64: addr is /tmp/packer-plugin395928238
2023/09/04 09:31:13 packer-plugin-oracle_v1.0.4_x5.0_linux_amd64 plugin: 2023/09/04 09:31:13 Serving a plugin connection...
2023/09/04 09:31:13 packer-plugin-oracle_v1.0.4_x5.0_linux_amd64 plugin: 2023/09/04 09:31:13 [TRACE] starting builder oci

Error: Unsupported argument
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.