Commit Graph

109 Commits

Author SHA1 Message Date
Hernán Schmidt 2d8f3f257a Fix small typo 2017-04-03 10:38:35 +02:00
Joshua Spence af2c84de5a Add `basename` and `dirname` functions
Adds `basename` and `dirname` interpolation. I want to add a `stack` tag to our infrastructure, the value of which is set to `${basename(path.cwd)}`. We currently use `${replace(path.cwd, "/^.+\\//", "")}` instead, but this is extremeley unreadable. The existance of a `basename` function would be very useful for this use case.

I don't have an immediate use case for a `dirname` function, but it seemed reasonable to add it as well.
2017-03-28 09:29:26 -07:00
Joshua Spence e71d6d92ad Add a substring interpolation function (#12870)
Adds a new `substr` interpolation function which can be used to truncate a string.
2017-03-22 11:30:39 -04:00
Mitchell Hashimoto 173e8562d4
website: document terraform.env 2017-03-13 16:39:05 -07:00
Kit Ewbank 549cff56d0 Add 'slice' interpolation function. (#9729) 2017-02-13 21:20:02 +00:00
Jake Champlin 0a1991c82e
match paragraph indentation 2017-01-20 12:01:07 -05:00
Jake Champlin be45816c80
documentation: Add warning for pathexpand interpolation function
Note that the `pathexpand` interpolation function could cause an unwanted diff on two different hosts
2017-01-20 09:51:25 -05:00
Jake Champlin 5749217869 Merge pull request #11277 from hashicorp/f-add-tilde-expansion
core: Add pathexpand interpolation function
2017-01-19 09:35:33 -05:00
Jake Champlin 0b73b92830
core: Add pathexpand interpolation function
Adds the `pathexpand` interpolation function to allow users to expand `~` to the home directory in filepath strings.
2017-01-18 16:11:19 -05:00
Benjamin Richter a54d8a2d73 Remove obsolete reference from interpolation.html.md
The reference to the resources page is obsolete, the splat syntax is not described there (nor anywhere else, as far as I can see).
2017-01-18 11:36:20 +01:00
Benjamin Richter a53c827bdd Update interpolation.html.md (#11223)
correct typo
2017-01-17 15:40:56 +00:00
Matt Clegg a297d81dcd Fix bullet points (Whitespace formatting) 2016-12-21 15:51:54 +01:00
Michael H. Oshita a48de8cb9a syntax typo in doc for lookup() (#10783) 2016-12-16 11:29:01 +00:00
James J. Goodhouse ecbc3e066a fix interpolation syntax typo for website docs 2016-12-15 09:10:01 -08:00
Mitchell Hashimoto 4ab5356ff9
website: update website for conditionals 2016-12-07 20:49:31 -05:00
Jake Champlin 1f33952330
Add the timestamp interpolation function.
Adds the timestamp interpolation function, tests, and documentation to allow a user to insert an RFC 3339 formatted UTC timestamp.
2016-12-01 14:51:01 -05:00
Mitchell Hashimoto 8fab86a9d4
website: update docs for precedence rules 2016-11-15 15:29:38 -08:00
Mitchell Hashimoto 7d6b3b80b9
website: document escaping template vars [GH-9897] 2016-11-07 08:42:46 -08:00
Jason Wieringa 43dcc30ae8 Fixed typo on interpolation docs (#9880)
Removes extra slash in name
2016-11-04 19:48:44 +00:00
James Turnbull 18b3736ba4 Pass over the Interpolation page (#9703)
* Pass over the Interpolation page

Fixes some grammar, typos and structure. Updated some headings and fixed
a couple of spelling mistakes.

* Added proper note syntax

* Turned some notes into actual notes

* Couple of minor typos just noticed
2016-10-29 01:13:09 +01:00
Jesse Szwedko 0fbd72a355 Add some basic math interpolation functions
Support the following math functions for interpolation:

* ceil
* floor
* max
* min

Fixes #7409
2016-10-28 17:49:31 +00:00
Mitchell Hashimoto 296ce59f37 Merge pull request #9624 from rottenbytes/TF-9169
Add a note about operator precedence. #9169
2016-10-27 08:14:45 -04:00
James Nugent 47bce79b29 core: Add zipmap interpolation function
This commit adds a new interpolation function, zipmap, which produces a
map given a list of string keys and a list of values of the same length
as the list of keys.

The name comes from the same operation in Clojure (and likely other
functional langauges).
2016-10-26 11:28:36 -05:00
Gustavo 5910e3b8af Adds ‘tittle’ built-in function. (#9087)
The tittle function returns a copy of the string with the first characters of all the words capitalized.
2016-10-26 13:21:32 +01:00
Nicolas Szalay c1be0c51c6 Add a note about operator precedence. #9169 2016-10-26 14:03:50 +02:00
James Turnbull f83c988496 Added another anchor 2016-10-25 03:39:15 -04:00
James Turnbull e0fab2267b I'd like to be able to anchor to functions 2016-10-21 17:28:01 +11:00
James Turnbull affb2c6511 Added list element syntax 2016-10-18 23:37:50 +11:00
Nick Walke b361347812
Added the word string to make more sense 2016-10-07 10:24:06 -05:00
Nick Walke 04d0d0f0ae
Added explicit map and list variable usage
This page did not show how to actually use a list as a list.  The
variables page states that "The usage of maps, list, strings, etc. is
documented fully in the interpolation syntax page", but that wasn't the
case.

I've split them out to list them explicitly and provide examples of
each.

Closes #9037
2016-10-07 10:20:17 -05:00
Radek Simko 43de2afde1
docs: Fix misspelled words 2016-09-12 07:08:00 +01:00
Paul Stack b49fbb5383 Merge pull request #8566 from MiLk/docs/interpolation-template-data
Template are now data sources
2016-09-04 00:30:11 +03:00
zhuk-intetics 3308b974e2 Update interpolation.html.md 2016-08-31 10:19:17 +03:00
Emilien Kenler 95a86cc617
Template are now data sources 2016-08-31 12:04:55 +09:00
alex goretoy 7938eaf76f Fix typo on interpolation.html.md (#8274) 2016-08-17 16:07:52 -05:00
James Nugent 9fa978a45f docs: Fix map key interpolation documentation
Previously was recommending the now-invalid dot syntax for map keys,
change to using HIL indexing.
2016-08-09 16:03:05 -04:00
Cecchi MacNaughton 8d9a9ddebe Correct typo in `length()` documentation (#7947) 2016-08-03 18:48:00 +01:00
James Bardin 2a11f3a138 make variadic syntax consistent in docs 2016-08-02 09:34:29 -04:00
James Bardin 068059ab3f Add `merge` doc 2016-08-02 09:33:08 -04:00
Paul Hinze d50aeeef0d
website: Docs sweep for lists & maps 2016-07-28 15:49:53 -05:00
Paul Hinze 88030764ff
config: Audit all interpolation functions for list/map behavior
- `distinct()` - error on non-flat lists
 - `element()` - error on non-flat lists
 - `join()` - error on non-flat lists
 - `length()` - support maps
 - `lookup()` - error on non-flat maps
 - `values()` - error on non-flat maps
2016-07-28 09:56:30 -05:00
Paul Hinze 1425b34562
config: Add map() interpolation function
* `map(key, value, ...)` - Returns a map consisting of the key/value pairs
  specified as arguments. Every odd argument must be a string key, and every
  even argument must have the same type as the other values specified.
  Duplicate keys are not allowed. Examples:
  * `map("hello", "world")`
  * `map("us-east", list("a", "b", "c"), "us-west", list("b", "c", "d"))`
2016-07-27 13:03:08 -05:00
James Bardin 2bd7cfd5fe Expand list interpolation to lists and maps
Allow lists and maps within the list interpolation function via variable
interpolation. Since this requires setting the variadic type to TypeAny,
we check for non-heterogeneous lists in the callback.
2016-07-19 13:44:37 -04:00
James Nugent 58dd41f3b1 core: Add list() interpolation function
The list() interpolation function provides a way to add support for list
literals (of strings) to HIL without having to invent new syntax for it
and modify the HIL parser.

It presents as a function, thus:

    - list() -> []
    - list("a") -> ["a"]
    - list("a", "b") -> ["a", "b"]

Thanks to @wr0ngway for the idea of this approach, fixes #7460.
2016-07-18 18:12:11 -04:00
Mike LoSapio 6f9b3aa4fd Clarify join produces a string 2016-07-07 09:51:15 -04:00
James Bardin 80365282cc Add documentation for keys and values
Add documentation for the keys and values interpolation functions
2016-06-29 15:11:08 -04:00
James Nugent 4b6a632246 core: Rename uniq -> distinct and add docs 2016-06-15 13:25:17 +02:00
James Nugent 578ff9569e core: Add sort() interpolation function 2016-06-11 18:03:52 +01:00
Mark Bainter 267d206a52 Update examples using concat with strings
Since using concat() to join strings is deprecated and soon to be removed, this patch updates the sha examples to use interpolation instead.
2016-06-03 17:49:54 -05:00
Chris Weyl 92e23d2252 add an example of cidrsubnet() being used with ipv6
...as this will hopefully clue people in that this function will indeed
work to manipulate ipv6 networks.

Not that I completely spaced on that for quite some time, or anything
like that.

Nope, not me.  Not at all.
2016-05-29 15:41:16 -05:00