Packer - Build d'images (VMs, containers, ISOs)
Find a file
Joban 2ff129cd34 fix(example): make UUIDv4 example RFC compliant
# Description

The output of the example on [uuidv4 Function](https://developer.hashicorp.com/packer/docs/templates/hcl_templates/functions/uuid/uuidv4) is not a valid RFC compliant UUIDv4. It indicates the usage of the `uuidv4()` function and outputs `b5ee72a3-54dd-c4b8-551c-4bdc0204cedb` which is not a valid UUIDv4.

I've corrected the example to output a UUIDv4 conforming to the RFC as such `xxxxxxxx-xxxx-4xxx-Nxxx-xxxxxxxxxxxx`, where:

- The 13th character is always `4` (indicating version 4).
- The 17th character must be either `8`, `9`, `a`, or `b` (indicating the first character of the variant).

# Changes

```diff
- b5ee72a3-54dd-c4b8-551c-4bdc0204cedb
+ 9fc99a70-7cd5-482d-bb2b-03af016e4e94
```

Replaces the old UUID output with a valid RFC compliant UUIDv4.

# References

- [RFC 4122](https://datatracker.ietf.org/doc/html/rfc4122)
- [RFC 9562](https://datatracker.ietf.org/doc/html/rfc9562)

# Misc.

To make sure this wasn't an issue with the `uuidv4()` function within Hashicorp's [packer](https://github.com/hashicorp/packer) I tested the function in the following way:

### Command executed:

```ps
> .\packer.exe inspect .\uuid.pkr.hcl
```

### Contents of the _uuid.pkr.hcl_ file:

```hcl
locals {
  uuid_0 = uuidv4()
  uuid_1 = uuidv4()
  uuid_2 = uuidv4()
  uuid_3 = uuidv4()
  uuid_4 = uuidv4()
  uuid_5 = uuidv4()
  uuid_6 = uuidv4()
  uuid_7 = uuidv4()
  uuid_8 = uuidv4()
  uuid_9 = uuidv4()
}
```

### Output:

```ps
Packer Inspect: HCL2 mode

> input-variables:


> local-variables:

local.uuid_0: "90877db8-5519-46ea-ae15-7dfb92594064"
local.uuid_1: "fe6a4649-97d9-4686-b981-3295175f941a"
local.uuid_2: "9944d83d-dab2-4cfb-a1db-572d19271e7a"
local.uuid_3: "547cddb7-c979-4b87-90d0-2bd9b68858b5"
local.uuid_4: "c13dc47a-552c-4dfb-a75d-2f63bb248b41"
local.uuid_5: "3db1ce29-bdde-4642-b010-1a41d47c22a3"
local.uuid_6: "4a020460-edd1-471d-b8a2-5956c0c68257"
local.uuid_7: "1845bf87-6908-4fc0-8f11-b5b4f36c60a7"
local.uuid_8: "f5c7e552-b799-45f3-8172-46162eadfd89"
local.uuid_9: "057c2eaf-6769-4a8d-90c8-775aec80496a"

> builds:
```
2025-01-21 10:13:57 -05:00
.github Result of tsccr-helper -log-level=info gha update .github/ 2025-01-20 17:25:44 -05:00
.release release: ignore AWS SDK vulnerability for release 2025-01-06 15:12:19 -05:00
acctest packer: relax constraints on sources 2024-04-29 14:28:24 -04:00
builder packer: address unused lint errors 2024-07-18 10:51:17 -04:00
cmd chore: remove refs to deprecated io/ioutil 2023-09-26 11:13:31 -04:00
command fix: packer validate unsupported type error 2025-01-21 10:06:45 -05:00
contrib/zsh-completion Update fix command autocomplete to work for JSON template files only (#12366) 2023-04-14 13:00:24 -04:00
datasource datasource/http: change Outputs->ExpectedOutputs 2024-11-04 15:15:30 -05:00
examples Fixes typos in docs (#11322) 2021-10-11 10:19:49 +02:00
fix packer: address gosimple lint errors 2024-07-18 10:51:17 -04:00
hcl2template hcl2template: add anytrue function 2025-01-21 10:07:10 -05:00
helper [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
internal internal/dag: remove unused code 2024-10-29 16:10:29 -04:00
packer fix: fix slice init length 2024-10-29 16:22:50 -04:00
packer_test build(deps): bump golang.org/x/net in /packer_test/common/plugin_tester 2025-01-21 09:49:43 -05:00
post-processor packer: address unused lint errors 2024-07-18 10:51:17 -04:00
provisioner packer: address gosimple lint errors 2024-07-18 10:51:17 -04:00
scripts scripts: re-add wait for changelog listing (#13002) 2024-05-31 05:49:23 -04:00
version version: bump main to 1.12.0-dev 2024-05-31 15:17:52 -04:00
website fix(example): make UUIDv4 example RFC compliant 2025-01-21 10:13:57 -05:00
.copywrite.hcl update year in license files 2023-12-06 12:43:42 -08:00
.gitattributes HCL2: add templatefile function (#10776) 2021-03-23 12:02:05 +01:00
.gitignore Remove the vendor dir (#10916) 2021-04-21 10:52:55 +02:00
.go-version build: ensure that LC_UUID is generated for Darwin binaries 2024-11-22 13:29:35 -05:00
.golangci.yml golangci.yml: add rule to not run errcheck on test 2024-07-18 10:51:17 -04:00
background_check.go [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
background_check_openbsd.go [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
CHANGELOG.md CHANGELOG: update for 1.11.2 release 2024-07-30 09:47:58 -04:00
checkpoint.go [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
CODEOWNERS let education also edit the docs side navigation 2024-12-10 13:47:13 -05:00
commands.go commands: introduce plugin as alias to plugins 2024-03-11 15:06:13 -04:00
config.go config: rm mono-component support from config file (#12998) 2024-05-30 14:25:08 +02:00
config_test.go config: rm mono-component support from config file (#12998) 2024-05-30 14:25:08 +02:00
Dockerfile Dockerfile: Add Product directory to /usr/share/doc directory 2024-04-23 09:28:35 -04:00
go Bump Go tooling version to 1.20.8 2023-10-03 10:32:42 -04:00
go.mod build(deps): bump github.com/hashicorp/hcp-sdk-go 2025-01-21 09:49:04 -05:00
go.sum build(deps): bump github.com/hashicorp/hcp-sdk-go 2025-01-21 09:49:04 -05:00
LICENSE update year in license files 2023-12-06 12:43:42 -08:00
log.go log: simplify the logOutput function 2024-07-18 10:51:17 -04:00
main.go packer: address errcheck lint errors 2024-07-18 10:51:17 -04:00
main_test.go [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
Makefile Makefile: replace enumer upstream with dmarkham's (#13107) 2024-07-16 21:14:27 -04:00
panic.go [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
README.md Update README 2023-10-26 15:03:55 -04:00
tty.go [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
tty_solaris.go [COMPLIANCE] License changes (#12568) 2023-08-10 15:53:29 -07:00
Vagrantfile vagrantfile: add support for docker provider 2018-10-31 16:58:06 +03:00

Packer

License: BUSL-1.1 Build Status Discuss

HashiCorp Packer logo

Packer is a tool for building identical machine images for multiple platforms from a single source configuration.

Packer is lightweight, runs on every major operating system, and is highly performant, creating machine images for multiple platforms in parallel. Packer supports various platforms through external plugin integrations, the full list of which can be found at https://developer.hashicorp.com/packer/integrations.

The images that Packer creates can easily be turned into Vagrant boxes.

Quick Start

Packer

There is a great introduction and getting started guide for building a Docker image on your local machine without using any paid cloud resources.

Alternatively, you can refer to getting started with AWS to learn how to build a machine image for an external cloud provider.

HCP Packer

HCP Packer registry stores Packer image metadata, enabling you to track your image lifecycle.

To get started with building an AWS machine image to HCP Packer for referencing in Terraform refer to the collection of HCP Packer Tutorials.

Documentation

Comprehensive documentation is viewable on the Packer website at https://developer.hashicorp.com/packer/docs.

Contributing to Packer

See CONTRIBUTING.md for best practices and instructions on setting up your development environment to work on Packer.

Unmaintained Plugins

As contributors' circumstances change, development on a community maintained plugin can slow. When this happens, HashiCorp may use GitHub's option to archive the plugins repository, to clearly signal the plugin's status to users.

What does unmaintained mean?

  1. The code repository and all commit history will still be available.
  2. Documentation will remain on the Packer website.
  3. Issues and pull requests are monitored as a best effort.
  4. No active development will be performed by HashiCorp.

If you are interested in maintaining an unmaintained or archived plugin, please reach out to us at packer@hashicorp.com.