Commit graph

138 commits

Author SHA1 Message Date
Karthik P
51eeadba3d
feat: add sum, startswith and endswith functions
This commit adds 3 new HCL2 functions:

* `sum`: computes the sum of a collection of numerical values
* `startswith`: checks if a string has another as prefix
* `endswith`: checks if a string has another as suffix
2025-04-14 11:49:36 -04:00
trujillo-adam
35eed086c1
Replace .io links with devdot links (#13335)
* replace .io links with devdot links

* update links in website docs readme
2025-03-28 07:10:47 -07:00
trujillo-adam
f46d0f6da4
Update website/content/docs/templates/legacy_json_templates/user-variables.mdx
Co-authored-by: Ruben Nic <RubenSandwich@users.noreply.github.com>
2025-01-31 14:28:18 -08:00
trujillo-adam
c310eac0cc
Merge pull request #13284 from hashicorp/docs/packer-seo-functions-batch3
Docs/packer seo functions batch3
2025-01-30 11:08:48 -08:00
trujillo-adam
c3df63af1e removed 'learn to' keyword phrases 2025-01-30 10:14:03 -08:00
trujillo-adam
3e3459b3a8
Update website/content/docs/templates/hcl_templates/functions/encoding/base64decode.mdx
Co-authored-by: rita <8647768+ritsok@users.noreply.github.com>
2025-01-30 10:06:13 -08:00
trujillo-adam
06af5e646d
Apply suggestions from code review
Co-authored-by: rita <8647768+ritsok@users.noreply.github.com>
2025-01-30 10:05:01 -08:00
trujillo-adam
8e6c32ce19 fix typo 2025-01-29 14:15:55 -08:00
trujillo-adam
0c0f7a6c41
Merge pull request #13282 from hashicorp/docs/packer-seo-templates-batch1
Docs/packer seo templates batch1
2025-01-29 10:41:19 -08:00
trujillo-adam
f46a4351e6
Apply suggestions from code review 2025-01-29 10:36:05 -08:00
trujillo-adam
b417abafa0 ipnet and uuid funcs 2025-01-29 10:18:14 -08:00
trujillo-adam
d8fa10e6eb string functions 2025-01-29 09:51:34 -08:00
trujillo-adam
f86801abc6
Apply suggestions from code review
Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com>
2025-01-29 08:33:36 -08:00
trujillo-adam
ad18e70980
Apply suggestions from code review
Co-authored-by: Brian McClain <brianmmcclain@gmail.com>
2025-01-29 08:15:40 -08:00
trujillo-adam
8b84cce611 numeric and conversion functions 2025-01-28 16:00:32 -08:00
trujillo-adam
8ad24fd454 encoding functions 2025-01-28 15:39:09 -08:00
trujillo-adam
2929047d88 contextual and datatime functions 2025-01-28 14:59:40 -08:00
trujillo-adam
75678c5de2 file functions references 2025-01-28 12:15:44 -08:00
trujillo-adam
953c814ad5 crypto and collection functions references 2025-01-28 11:22:54 -08:00
trujillo-adam
54da4b047f hcl templates content except functions 2025-01-28 09:44:33 -08:00
trujillo-adam
a9ada1d19d hcl template blocks 2025-01-27 14:44:31 -08:00
trujillo-adam
ba3c07bf66 legacy json template ref 2025-01-24 12:28:52 -08:00
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
Martin Grogan
cb4965d53a hcl2template: add anytrue function
this function add the hcl2 anytrue function which takes a collection and
return true if any of the element is true.
2025-01-21 10:07:10 -05:00
Martin Grogan
476ddc3810 hcl2template: add alltrue function
add an hcl2 function that return true if all the value in a collection
are true, this function was derived from terraform codebase
2025-01-21 10:07:10 -05:00
Martin Grogan
35682265c4 docs: add strcontains function doc 2024-12-05 16:04:00 -05:00
Gregory Bonk
cef978f17c Update datasources.mdx
change Locals to local
2024-10-15 14:08:16 -04:00
Wenfeng Pan
1b160e5df0
Add base64gzip function support to Packer template 2024-08-13 14:53:29 -04:00
Ryan Johnson
66abaaeb4e docs: string templates
Adds an example of a string template being used.

The example demonstrates how a template sequence can be used to embed the value of a variable into a string that can be used as script content.

Ref: #12651

Signed-off-by: Ryan Johnson <ryan.johnson@broadcom.com>
2024-06-14 18:12:34 -04:00
trujillo-adam
d75975821f
Update plugins install docs for v1.11.0 (#12995)
* IPE-727 first commit, adds release notes

* content for the 1.11 release notes

* updates to init CLI reference

* updates to install plugins CLI reference

* updates to source information on the packer block configuration reference

* updated Packer configuration page

* updated plugins installation overview page

* updated plugins installation usage page

* added Upgrades section

* added outline for an upgrade page for this version

* added comments for upgrade page outline

* renamed install plugins mdx and added redirects

* Apply suggestions from code review

Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>

* fix nav

* fix bad links

* applying additional feedback

* Apply suggestions from code review

Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>

* integrated rationale into release notes

* removed 'upgrade from older version' section in the upgrade instructions

* docs: fill-in the upgrade/1.11 document

* Apply suggestions from code review

Co-authored-by: Wilken Rivera <wilken@hashicorp.com>

* edits to upgrade 1.11 and release note

* Apply suggestions from code review

Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>

---------

Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>
Co-authored-by: Lucas Bajolet <lucas.bajolet@hashicorp.com>
Co-authored-by: Wilken Rivera <wilken@hashicorp.com>
2024-05-31 14:52:47 -04:00
Lucas Bajolet
accbe97e1e
hcl2template: add text(encode|decode)base64 funcs (#12997)
Compared to Terraform, Packer was lacking a capability to encode/decode
strings to/from base64-encoded text encoded with another encoding.

This could be problematic in some cases, mainly when working with
Windows, as most of the OS uses UTF-16LE as its standard encoding for
many operations.

Therefore, we take a page from Terraform here, and add those functions
to what Packer supports in an HCL2 context.
2024-05-30 14:24:46 +02:00
Wilken Rivera
a7591c950a Add details on the importance of using required_plugins 2024-05-15 14:50:24 -04:00
Wilken Rivera
27b5f27ec9 Add section for Non-GitHub source addresses 2024-05-15 14:50:24 -04:00
Wilken Rivera
ce7205ed79 required_plugins:Add source addresses section
* Document the purpose of a source address
* Add a note about non-GitHub source addresses containing one of more sub-folder parts
2024-05-15 14:50:24 -04:00
pavedroad
a27ef0d035 chore: remove repetitive words
Signed-off-by: pavedroad <qcqs@outlook.com>
2024-03-12 09:36:26 -04:00
Devashish
4b591d6937 Add PR suggestions 2024-01-26 14:31:04 -05:00
Devashish
14ce2a559c fix shell session in the docs 2024-01-26 14:31:04 -05:00
Devashish
b77d581cda Add the deprecation warning and update docs 2024-01-26 14:31:04 -05:00
ygXXII
19c14fd1e2
docs: fix aws_secretsmanager Title Name (#12678)
Just a simple doc title fix.
2023-11-02 05:36:36 -04:00
Lucas Bajolet
c528681dde docs: amend HCL templates/functions docs
The HCL2 docs on built-in functions contains a link to a non-existent
section of the expressions page, so we update it to link to the general
page, and to the string interpolation section, since it is a common use
case.
2023-10-30 09:36:03 -04:00
Wilken Rivera
0ec424aa25
Fix broken link to Consul's environment variables page (#12673) 2023-10-30 07:50:53 -04:00
Kévin Dunglas
739b2acd20
docs: fix typo (#12493) 2023-07-19 17:35:26 -04:00
GaryNg
58b193f221 Use backtick to prevent html parsing
Co-authored-by: Lucas Bajolet <105649352+lbajolet-hashicorp@users.noreply.github.com>
2023-07-19 11:54:11 -04:00
GaryNg
cc1e2fca78 Prefix url with product slug 2023-07-19 11:54:11 -04:00
GaryNg
5271c28749 Add closing code block 2023-07-19 11:54:11 -04:00
Samuel Phan
09e9643881 docs: add missing end quote 2023-05-29 13:33:17 -04:00
josiahsmythe-bah
f81e9c2222
Fixed formatting issue 2023-05-03 11:38:52 -04:00
Wilken Rivera
f809cbce5f Remove circular reference between data source documentation pages
* Update the data source documentation with a link to the amazon-ami configuration reference guide.

Closes #12336
2023-04-28 16:30:01 -04:00
Lucas Bajolet
1ad92b0759 docs: add docs to show diffs between JSON and HCL2 2023-04-28 13:58:45 -04:00
Alan Szlosek Jr
485e080725
clarify local and input variables (#12334)
* clarify local and input variables

* Apply suggestions from code review

Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com>
Co-authored-by: Wilken Rivera <wilken@hashicorp.com>

* Apply suggestions from code review

Co-authored-by: Wilken Rivera <wilken@hashicorp.com>

---------

Co-authored-by: Rose M Koron <32436232+rkoron007@users.noreply.github.com>
Co-authored-by: Wilken Rivera <wilken@hashicorp.com>
2023-04-12 18:05:29 -04:00