-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add instance_id to state so ID is usable in provisioners #84
Conversation
Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement Learn more about why HashiCorp requires a CLA and what the CLA includes Have you signed the CLA already but the status is still pending? Recheck it. |
Hi @vheon, From a quick glance at the code, this looks OK to me! For testing, when you build the plugin, it will output a binary, which can then be loaded by Packer according to the rules specfied in this documentation section. By any chance, could you share your template so we can help? Also FYI, before we can merge this PR, we'll need you to sign our CLA first. This is not a pressing matter as we still need to ensure this works as expected, but please be aware this is required by our legal department for external contributions. Thanks, and please let us know if we can help further! |
Looking at the documentation I thought that I could simply build the plugin and copy it in the directory where I ran
packer {
required_plugins {
lxd = {
version = ">= 1.0.1"
source = "github.com/hashicorp/lxd"
}
ansible = {
source = "github.com/hashicorp/ansible"
version = "~> 1"
}
}
}
source "lxd" "centos7" {
image = "images:centos/7"
}
build {
name = "test"
source "lxd.centos7" {
output_image = "test-image"
publish_properties = {
description = "Make with Packer"
}
}
provisioner "ansible" {
playbook_file = "./playbooks/main.yml"
user = "root"
extra_arguments = [ "--extra-vars", "ansible_host=${build.ID} ansible_connection=${source.type}" ]
ansible_env_vars = ["ANSIBLE_FORCE_COLOR=1"]
}
} and ---
- name: Test play
hosts: all
gather_facts: false
tasks:
- name: Test
ansible.builtin.ping: the output of
Looking at the log it doesn't seems to pick up the plugin in the current directory. Any help would be appreciated. |
Hey @vheon, Sounds on point, you're running into this behaviour: "Where applicable, some installation processes such as packer init may override the plugin loading process." To be fair, we think this is confusing, and are re-thinking our process for installing/loading plugins from Packer, please refer to this issue on Packer for information. If you have an opinion on this subject, please don't hesitate to share it in this issue! For your case, if you want to be able to load the plugin, there's essentially two choices at the moment:
Hope that helps! |
@vheon the changes look good but we need you to sign the CLA before we can approve and merge. |
Hi there 👋, I'm going to close this pull-request since there hasn't been any updates to it since the last request for the CLA. But if you are still interested in seeing this change please feel free to leave a comment after the signing the CLA we will gladly reopen. |
Hi,
The change I'm proposing should be pretty straightforward but I'm having difficulty testing it as
packer
is not picking up my locally built plugin and keep using the "official" one. Also the content of the linked CONTRIBUTING.md file seems sort of not updated.https://github.com/hashicorp/packer-plugin-lxd/blob/main/.github/CONTRIBUTING.md#opening-an-pull-request
Any pointers would be welcome on this 🙏