Commit Graph

53 Commits

Author SHA1 Message Date
Loek Duys c6fa1e70ef
Update toset.mdx
Fix output in `toset`
```
toset(["a", "b", 3])
toset([
  "3",
  "a",
  "b",
])
```

This is the actual output from the tf console, using Terraform v1.1.5 on windows_amd64
2022-03-15 13:48:14 +01:00
Laura Pacilio 68e70d71d4
Merge pull request #30483 from bpar476/patch-1
Adds documentation to `substr` function to cover when `length` exceeds input length
2022-02-15 11:27:47 -05:00
Ben Partridge 252865c6a0
Improvements to wording of substr function documentation
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2022-02-15 10:23:37 +11:00
Alisdair McDiarmid 98f80bc5da website: Explain limitations of type function 2022-02-10 06:12:58 -05:00
Ben Partridge fa8a87fab5
Adds documentation to `substr` function to cover when `length` longer than input `string`
The `substr` function allows the `length` parameter to be longer than the remaining characters in the input after the offset. This is useful for when you want to truncate a string to a maximum number of characters. However, the documentation isn't clear on this so I had to do a test deployment to confirm the behaviour after finding the behaviour in an old issue https://github.com/hashicorp/terraform/issues/15751
2022-02-07 15:12:22 +11:00
GiannakopoulosJ 13907690a2
Typo in zipmap documentation
zipmap does not produce a map with comma in terraform cli
tested with Terraform v1.1.3
2022-01-19 16:02:24 +02:00
Martin Atkins e35c25da44 website: Try function documentation "provably" vs "probably" typo
This paragraph is trying to say that try only works for dynamic errors and
not for errors that are _not_ based on dynamic decision-making in
expressions.

I'm not sure if this typo was always here or if it was mistakenly "corrected"
at some point, but either way the word "probably" changes the meaning
of this sentence entirely, making it seem like Terraform is hedging
the likelihood of a problem rather than checking exactly for one.
2021-12-22 12:10:07 -08:00
Dylan Staley 21cbb5b392 migrate docs to mdx 2021-12-14 18:41:17 -08:00
Dylan Staley 0e48f58688 Revert "migrate docs to mdx"
This reverts commit 3cb12b5a52.
2021-11-22 15:57:25 -08:00
Dylan Staley 3cb12b5a52 migrate docs to mdx 2021-11-22 15:47:36 -08:00
Laura Pacilio bd64d07e6b Apply suggestions from code review 2021-11-15 10:49:37 -05:00
Laura Pacilio b838a93023 Add cidr block output example to setproduct function page 2021-11-05 10:51:59 -04:00
Krista LaFentres 1f08f7dba8 Clarify the way the trim() function works and add some more examples 2021-10-25 14:13:15 -05:00
Laura Pacilio 73a3bb2702
Merge pull request #28334 from paultyng/patch-1
Add null to type conversion docs
2021-09-02 14:47:38 -04:00
Laura Pacilio 03849d850a
Merge pull request #28486 from joshschmitter/patch-1
setsubtract doc: use "Relative Complement" correctly
2021-08-23 15:49:51 -04:00
joshschmitter cb41b158f1
concise use of "relative complement"
Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com>
2021-08-23 14:40:35 -05:00
Laura Pacilio d427c81a89 Update jsonencode minified note 2021-08-23 15:01:38 -04:00
Laura Pacilio dffb8b4a16
Merge pull request #29088 from brenthc/minify_jsonencode
note that output of jsonencode is minified
2021-08-23 14:24:37 -04:00
Brent Woodruff ed84cb886e
Apply suggested wording update. 2021-08-23 14:10:50 -04:00
Laura Pacilio 5863af448f
Merge pull request #28784 from TAYTS/patch-2
Update range.html.md
2021-08-23 14:07:15 -04:00
Laura Pacilio d0bc382797
Merge pull request #29359 from 45deg/45deg-patch-1
Fix a result in examples for urlencode.html.md
2021-08-23 13:57:27 -04:00
Laura Pacilio e1b702b8d0
Merge pull request #29417 from jonesetc/patch-1
Fix link to index function
2021-08-18 18:24:54 -04:00
Laura Pacilio b574c03dd1
Merge pull request #29271 from kebroad/patch-1
Fixed cidrhost() example 1 and 2 with correct function parameter
2021-08-18 18:22:06 -04:00
Kyle Jones e4e5f5a1a4
Fix link to index function
The element function page previously linked to the index page for all functions where it meant to link to the index function page.
2021-08-18 15:08:19 -07:00
Martin Atkins c23a7fce4e lang/funcs: Preserve IP address leading zero behavior from Go 1.16
Go 1.17 includes a breaking change to both net.ParseIP and net.ParseCIDR
functions to reject IPv4 address octets written with leading zeros.

Our use of these functions as part of the various CIDR functions in the
Terraform language doesn't have the same security concerns that the Go
team had in evaluating this change to the standard library, and so we
can't justify an exception to our v1.0 compatibility promises on the same
sort of security grounds that the Go team used to justify their
compatibility exception.

For that reason, we'll now use our own fork of the Go library functions
which has the new check disabled in order to preserve the prior behavior.
We're taking this path, rather than pre-normalizing the IP address before
calling into the standard library, because an additional normalization
layer would be entirely new code and additional complexity, whereas this
fork is relatively minor in terms of code size and avoids any significant
changes to our own calls to these functions.

Thanks to the Kubernetes team for their prior work on carving out a subset
of the "net" package for their similar backward-compatibility concern.
Our "ipaddr" package here is a lightly-modified fork of their fork, with
only the comments changed to talk about Terraform instead of Kubernetes.

This fork is not intended for use in any other future feature
implementations, because they wouldn't be subject to the same
compatibility constraints as our existing functions. We will use these
forked implementations for new callers only if consistency with the
behavior of the existing functions is a key requirement.
2021-08-17 15:20:05 -07:00
45deg 494043ed24
Fix a result in examples for urlencode.html.md 2021-08-12 13:47:27 +09:00
Kevin Broadbridge f5cbe59386 Fixed cidrhost example 1 and 2 with correct function parameter 2021-07-29 16:30:18 -05:00
Laura Pacilio 06a2fdcf9d Merge branch 'main' into description-metadata-language-docs 2021-07-21 16:24:59 -04:00
Laura Pacilio a780f625e9 Fix metadata description format on all pages 2021-07-19 12:11:10 -04:00
Kristin Laemmert 563f1436eb
various docs updates (#29018)
* website/docs: add sensitivity warning to output documentation

fixes #28005

* website/docs: add note about ** to fileset documentation

closes #24220

* website/docs: add note that `dynamic` expressions aren't included in json config output

closes #28346

* website: the provider installer isn't necessarily concurrency safe

closes #28367
2021-07-15 12:22:17 -04:00
Laura Pacilio bc9065334e Update description metadata per PR feedback 2021-07-14 16:54:26 -04:00
Laura Pacilio 952cb33103 Add description metadata to functions overview page 2021-07-09 15:42:58 -04:00
Brent Woodruff 3a66236c14 note that output of jsonencode is minified 2021-07-02 15:36:47 -04:00
Laura Pacilio 577c3653f2
Merge pull request #28983 from KurtLehnardt/patch-1
fixed typo
2021-06-30 08:54:04 -04:00
Laura Pacilio de97a03528
Merge pull request #28908 from kondr57/patch-1
fix typo
2021-06-30 08:43:26 -04:00
Radek Simko bb868606ea
docs: Document naming conventions for templates & backend configs (#28924)
* docs: Document naming conventions for templates & backend configs

* Update website/docs/cli/config/config-file.html.md

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>

* Update website/docs/language/functions/templatefile.html.md

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>

Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2021-06-18 17:20:00 +01:00
Kurt Lehnardt 165b2a2509
fixed typo 2021-06-18 09:59:56 -06:00
Kristin Laemmert 9ca3cb4233
website/docs: move type func docs to a useful location (#28940)
* website/docs: move type func docs to a useful location

* docs don't exist if you don't put them in the index (again)
2021-06-14 08:54:27 -04:00
Vladimir Kondratiev 58a5207dc4
fix typo 2021-06-09 13:13:08 +03:00
TAY TS 511011335a
Update range.html.md
Fix the condition in the negative direction range pseudo code
2021-05-23 09:43:38 +08:00
James Bardin 760a59b3a7 negative substring 2021-05-18 16:04:47 -04:00
Steve Matney e27a927ba4 Updating sensitive and nonsensitive docs with correct v0.15 info. 2021-05-14 10:32:39 -06:00
joshschmitter 0c4e823ee6
setsubtract doc: use "Relative Complement" correctly
The explanation of the setsubtract function in terms of a Relative Complement is backwards.  Fixing it.
2021-04-22 08:26:50 -05:00
Martin Atkins 140c613ae8 lang/funcs: "one" function
In the Terraform language we typically use lists of zero or one values in
some sense interchangably with single values that might be null, because
various Terraform language constructs are designed to work with
collections rather than with nullable values.

In Terraform v0.12 we made the splat operator [*] have a "special power"
of concisely converting from a possibly-null single value into a
zero-or-one list as a way to make that common operation more concise.

In a sense this "one" function is the opposite operation to that special
power: it goes from a zero-or-one collection (list, set, or tuple) to a
possibly-null single value.

This is a concise alternative to the following clunky conditional
expression, with the additional benefit that the following expression is
also not viable for set values, and it also properly handles the case
where there's unexpectedly more than one value:

    length(var.foo) != 0 ? var.foo[0] : null

Instead, we can write:

    one(var.foo)

As with the splat operator, this is a tricky tradeoff because it could be
argued that it's not something that'd be immediately intuitive to someone
unfamiliar with Terraform. However, I think that's justified given how
often zero-or-one collections arise in typical Terraform configurations.
Unlike the splat operator, it should at least be easier to search for its
name and find its documentation the first time you see it in a
configuration.

My expectation that this will become a common pattern is also my
justification for giving it a short, concise name. Arguably it could be
better named something like "oneornull", but that's a pretty clunky name
and I'm not convinced it really adds any clarity for someone who isn't
already familiar with it.
2021-04-12 15:32:03 -07:00
Paul Tyng b8a0929a5d
Add null to tostring docs 2021-04-10 15:55:29 -04:00
Paul Tyng b3fe8713e8
Add null to tonumber docs 2021-04-10 15:54:51 -04:00
Paul Tyng eb927958bd
Add null to tobool docs 2021-04-10 15:52:23 -04:00
Víctor Felipe Godoy Hernández a9487c7674
Fix yamldecode example from json to yaml (#28220)
* Fix yamldecode example from json to yaml

* inline yaml example
2021-04-05 13:41:07 -04:00
Martin Atkins 89b2405080 lang/funcs: "sensitive" and "nonsensitive" functions
These aim to allow hinting to Terraform about situations where it's not
able to automatically infer value sensitivity.

"nonsensitive" is for situations where Terraform's behavior is too
conservative, such as when a new value is derived from a sensitive value
in such a way that all of the sensitive content is removed.

"sensitive", on the other hand, is for situations where Terraform can't
otherwise infer that a value is sensitive. These situations should be
pretty rare in a module that's making effective use of sensitive input
variables and output values, but the documentation shows one example of
an uncommon situation where a more direct hint via this function would
be needed.

Both of these functions are aimed at only occasional use in unusual
situations. They are here for reasons of pragmatism, not because we
expect them to be used routinely or recommend their use.
2021-03-16 16:26:22 -07:00
Stephen e39abbf6f0
fix regex logical or documentation (#27637)
* fix regex logical or documentation

Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2021-02-08 11:04:38 -05:00