generated from hashicorp/packer-plugin-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: refresh the documentation (#197)
- Update some broken links, - Split examples into multiple directories, - Link examples folder in the builder documentation, - Add tips for keeping images size small.
- Loading branch information
Showing
10 changed files
with
337 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,3 @@ | ||
## The Example Folder | ||
## Examples | ||
|
||
This folder must contain a fully working example of the plugin usage. The example must define the `required_plugins` | ||
block. A pre-defined GitHub Action will run `packer init`, `packer validate`, and `packer build` to test your plugin | ||
with the latest version available of Packer. | ||
|
||
The folder can contain multiple HCL2 compatible files. The action will execute Packer at this folder level | ||
running `packer init -upgrade .` and `packer build .`. | ||
|
||
If the plugin requires authentication, the configuration should be provided via GitHub Secrets and set as environment | ||
variables in the [test-plugin-example.yml](/.github/workflows/test-plugin-example.yml) file. Example: | ||
|
||
```yml | ||
- name: Build | ||
working-directory: ${{ github.event.inputs.folder }} | ||
run: PACKER_LOG=${{ github.event.inputs.logs }} packer build . | ||
env: | ||
AUTH_KEY: ${{ secrets.AUTH_KEY }} | ||
AUTH_PASSWORD: ${{ secrets.AUTH_PASSWORD }} | ||
``` | ||
This folder contain fully working examples of the plugin usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
packer { | ||
required_plugins { | ||
hcloud = { | ||
source = "github.com/hetznercloud/hcloud" | ||
version = ">=1.5.1" | ||
} | ||
} | ||
} | ||
|
||
variable "hcloud_token" { | ||
type = string | ||
sensitive = true | ||
default = "${env("HCLOUD_TOKEN")}" | ||
} | ||
|
||
source "hcloud" "docker" { | ||
token = var.hcloud_token | ||
|
||
location = "hel1" | ||
image = "ubuntu-24.04" | ||
server_type = "cpx11" | ||
server_name = "docker-{{ timestamp }}" | ||
|
||
user_data = <<-EOF | ||
#cloud-config | ||
growpart: | ||
mode: "off" | ||
resize_rootfs: false | ||
EOF | ||
|
||
ssh_username = "root" | ||
|
||
snapshot_name = "docker-{{ timestamp }}" | ||
snapshot_labels = { | ||
app = "docker" | ||
} | ||
} | ||
|
||
build { | ||
sources = ["source.hcloud.docker"] | ||
|
||
provisioner "shell" { | ||
inline = ["cloud-init status --wait --long"] | ||
valid_exit_codes = [0, 2] | ||
} | ||
|
||
provisioner "shell" { | ||
scripts = [ | ||
"install.sh", | ||
"upgrade.sh", | ||
"cleanup.sh", | ||
] | ||
} | ||
} |
Oops, something went wrong.