Commit Graph

16 Commits

Author SHA1 Message Date
Christian Mesh
19eed53765 Update funcs package to properly handle ephemeral values (#3168)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-09-10 07:45:23 -04:00
Christian Mesh
8ee707b3e6 Fix lint issues in internal/lang (#2786)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
2025-05-09 13:53:34 -07:00
James Humphries
89926cc97a Ensure that using a sensitive path for templatefile that it doesnt panic (#1801)
Signed-off-by: James Humphries <james@james-humphries.co.uk>
2024-07-23 09:06:02 -04:00
Christian Mesh
b51396fed5 Allow for templatefile recursion (up to 1024 depth default) (#1250)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Co-authored-by: Janos <86970079+janosdebugs@users.noreply.github.com>
2024-03-11 10:00:06 -04:00
Sanskruti Shahu
835dcb8121 Added templatestring function similar to templatefile (#1223)
Signed-off-by: sanskruti-shahu <sanskruti.shahu@harness.io>
Signed-off-by: Sanskruti Shahu <76054960+sanskruti-shahu@users.noreply.github.com>
Co-authored-by: James Humphries <James@james-humphries.co.uk>
2024-02-28 09:56:05 -05:00
namgyalangmo
cb2e9119aa Update copyright notice (#1232)
Signed-off-by: namgyalangmo <75657887+namgyalangmo@users.noreply.github.com>
2024-02-08 09:48:59 +00:00
Mikel Olasagasti Uranga
ceaa079937 Update to latest github.com/bmatcuk/doublestar (#1194)
Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2024-01-25 17:52:20 +01:00
Yaron Yarimi
059190f273 Rename multiple packages to OpenTofu (#488) 2023-09-20 15:59:27 +03:00
Lars Lehtonen
bc28cc35cc internal/lang/funcs: deprecate io/ioutil (#345)
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
2023-09-08 10:04:53 +02:00
RLRabinowitz
650b1a339a Adjust mentions of terraform in internal/lang 2023-08-23 11:12:15 +03:00
Martin Atkins
c912970153 lang/funcs: 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-05-24 13:44:08 -07:00
hashicorp-copywrite[bot]
325d18262e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
Martin Atkins
e95f29bf9d lang/funcs: fileexists slightly better "not a file" error message
Previously we were just returning a string representation of the file mode,
which spends more characters on the irrelevant permission bits that it
does on the directory entry type, and is presented in a Unix-centric
format that likely won't be familiar to the user of a Windows system.

Instead, we'll recognize a few specific directory entry types that seem
worth mentioning by name, and then use a generic message for the rest.

The original motivation here was actually to deal with the fact that our
tests for this function were previously not portable due to the error
message leaking system-specific permission detail that are not relevant
to the test. Rather than just directly addressing that portability
problem, I took the opportunity to improve the error messages at the same
time.

However, because of that initial focus there are only actually tests here
for the directory case. A test that tries to test any of these other file
modes would not be portable and in some cases would require superuser
access, so we'll just leave those cases untested for the moment since they
weren't tested before anyway, and so we've not _lost_ any test coverage
here.
2022-01-11 08:46:29 -08:00
Alisdair McDiarmid
5d7cb81c0c lang: Redact sensitive values from function errors
Some function errors include values derived from arguments. This commit
is the result of a manual audit of these errors, which resulted in:

- Adding a helper function to redact sensitive values;
- Applying that helper function where errors include values derived from
  possibly-sensitive arguments;
- Cleaning up other errors which need not include those values, or were
  otherwise incorrect.
2021-12-03 09:46:57 -05:00
Simão Gomes Viana
5bbd108572 funcs: defer close file in funcs
Files opened by these two functions were not being closed,
leaking file descriptors. Close files that were opened when the
function exist.
2021-11-16 09:25:49 +01:00
Martin Atkins
cdd9464f9a Move lang/ to internal/lang/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00