Commit graph

32 commits

Author SHA1 Message Date
hashicorp-copywrite[bot]
219421c08c [COMPLIANCE] Update Copyright and License Headers (Batch 2 of 5) 2025-12-11 07:02:15 +00:00
karthik P
c109e73f12 Merging main 2025-04-24 22:54:07 +05:30
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
Lucas Bajolet
9f3e32b9fc hcl2template: add support for raw aws secrets
As the SDK now supports it in the context of legacy templating engine,
we add support in HCL2 for the aws_secretsmanager_raw function, which
gets the raw value of a secret from aws secrets manager.
2025-01-21 14:39:49 -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
0ddcbaf18f hcl2template: add strcontains function
The strcontains function check if a sub string is a indeed a subset of a
given string.

hcl2template: add strcontains function

The strcontains function check if a sub string is a indeed a subset of a
given string.
2024-11-26 16:27:41 -05:00
Lucas Bajolet
da06110cc3 hcl2template: add filebase64 function
The filebase64 function aims to read and encode a file's contents into
base64.
This is mostly to support reading the content of a file that is not
valid UTF-8, as is the case with the `file` function.
2024-11-05 14:19:51 -05:00
Wenfeng Pan
1b160e5df0
Add base64gzip function support to Packer template 2024-08-13 14:53:29 -04:00
Wilken Rivera
263821ac25 hcl2template/functions: Add Non-null refinements for various functions
cty's new "refinements" concept allows us to reduce the range of unknown
values from our functions. This initial changeset focuses only on
declaring which functions are guaranteed to return a non-null result,
which is a helpful baseline refinement because it allows "== null" and
"!= null" tests to produce known results even when the given value is
otherwise unknown.

This commit also includes some updates to test results that are now
refined based on cty's own built-in refinement behaviors, just as a
result of us having updated cty in the previous commit.
2023-11-29 12:28:16 -05:00
hashicorp-copywrite[bot]
19055df3ec
[COMPLIANCE] License changes (#12568)
* Updating the license from MPL to Business Source License

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at https://hashi.co/bsl-blog, FAQ at https://hashi.co/license-faq, and details of the license at www.hashicorp.com/bsl.

* Update copyright file headers to BUSL-1.1

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-10 15:53:29 -07:00
hashicorp-copywrite[bot]
b7df3ca36f
[COMPLIANCE] Add Copyright and License Headers (#12254)
Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-03-02 15:37:05 -05:00
Adrien Delorme
eb8e302941
hcl2_upgrade: special case: vsphere fix (#11216)
* fix typo

* hcl2_upgrade: special case linux_options and network_interface to block instead of maps

* Update hcl2_upgrade_test.go

* Update hcl2_upgrade_test.go

remove unused code

* hcl2_upgrade: support strftime too (#11220)

* hcl2_upgrade strftime function
* create legacy_strftime.mdx
2021-08-25 14:20:08 +02:00
Sergio Conde Gómez
f6f2469d4d
fix: HCL "index" function now actually returns the index of the element (#11008) 2021-05-11 10:24:46 +02:00
Wilken Rivera
5e17dbeff2 Fix up regex in test 2021-03-23 14:39:45 -04:00
Adrien Delorme
ff01e6715a
HCL2: add templatefile function (#10776)
* tests
* docs
2021-03-23 12:02:05 +01:00
Megan Marsh
a6f907c688 tests 2021-03-17 10:48:55 -07:00
Megan Marsh
f12c89bd84 add legacy_isotime function to hcl funcs 2021-03-16 13:33:43 -07:00
Megan Marsh
88b7b0e14a remove sdk 2020-12-17 13:29:25 -08:00
Megan Marsh
7d658149ea update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
Adrien Delorme
deba1484ff
HCL2: allow calling env as input var default value (#10240)
* HCL2: allow to use env in default value of input variables
2020-11-11 11:27:32 +01:00
Adrien Delorme
8de2f40a07 add tests for length 2020-10-30 15:42:59 +01:00
Adrien Delorme
4d386dd806 add length function that can work with more types 2020-10-30 15:36:23 +01:00
Adrien Delorme
6d4fae0f2d
Add HCL2 aws_secretsmanager function (#10124)
* refactor aws get secrets function out to reuse it else where
* add aws_secretsmanager func and docs for HCL2
* fix GetSecret: allow to pick secret version
2020-10-20 16:21:40 +02:00
Megan Marsh
cc7dbf6092
Add consul_key function to integrate concul with hcl2 tempaltes. (#10119)
* Add consul_key function to integrate concul with hcl2 tempaltes.
* sidebar nav
2020-10-19 14:07:13 +02:00
jsmcnair
78c280b1b7 Use common funcs / fix panic / clarify docs 2020-08-12 22:34:13 +01:00
jsmcnair
33e3f62ff7 Add vault function for HCL2 and document 2020-08-11 09:18:15 +01:00
Adrien Delorme
cf6eca7e1c Revert "Add pwd function to HCL"
This reverts commit 2800043149.
2020-06-08 14:59:27 +02:00
Adrien Delorme
44dfa221de Revert "Add template_dir function to HCL"
This reverts commit 3b9a0427cd.
2020-06-08 14:59:22 +02:00
Jeremiah Snapp
3b9a0427cd Add template_dir function to HCL
Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
2020-06-05 13:14:36 -04:00
Jeremiah Snapp
2800043149 Add pwd function to HCL
Signed-off-by: Jeremiah Snapp <jeremiah@chef.io>
2020-06-05 13:14:03 -04:00
Adrien Delorme
193dad46e6
Hcl2 input variables, local variables and functions (#8588)
Mainly redefine or reused what Terraform did.

* allow to used `variables`, `variable` and `local` blocks
* import the following functions and their docs from Terraform: abs, abspath, basename, base64decode, base64encode, bcrypt, can, ceil, chomp, chunklist, cidrhost, cidrnetmask, cidrsubnet, cidrsubnets, coalesce, coalescelist, compact, concat, contains, convert, csvdecode, dirname, distinct, element, file, fileexists, fileset, flatten, floor, format, formatdate, formatlist, indent, index, join, jsondecode, jsonencode, keys, length, log, lookup, lower, max, md5, merge, min, parseint, pathexpand, pow, range, reverse, rsadecrypt, setintersection, setproduct, setunion, sha1, sha256, sha512, signum, slice, sort, split, strrev, substr, timestamp, timeadd, title, trim, trimprefix, trimspace, trimsuffix, try, upper, urlencode, uuidv4, uuidv5, values, yamldecode, yamlencode, zipmap.
2020-02-06 11:49:21 +01:00