Commit Graph

114 Commits

Author SHA1 Message Date
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 0885aeef93 docs: Mention map keys which start with a number
Fixes #6857.
2016-06-22 12:05:12 +03:00
James Nugent 4b6a632246 core: Rename uniq -> distinct and add docs 2016-06-15 13:25:17 +02:00
Veselin Kantsev b0a99ce35e corrected "here doc" syntax notes 2016-06-12 18:57:13 +01: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
David Adams 8a4fdc3dd5 Update docs for lookup() interpolation function
Add specifics about using the optional third argument for providing a
default value.
2016-05-25 19:35:09 -05:00
amangoel f891ab81f4 Update variables.html.md (#6869) 2016-05-25 16:38:32 +01:00
David Glasser 594ea105d8 config: support lists and maps in jsonencode
For now we only support lists and maps whose values are strings, not
deeply nested data.
2016-05-18 10:46:06 -07:00
Martin Atkins 64f2651204 website: Initial documentation about data sources
This will undoubtedly evolve as implementation continues, but this is some
initial documentation based on the design doc.
2016-05-14 08:26:36 -07:00
James Nugent b62f6af158 core: Add support for marking outputs as sensitive (#6559)
* core: Add support for marking outputs as sensitive

This commit allows an output to be marked "sensitive", in which case the
value is redacted in the post-refresh and post-apply list of outputs.

For example, the configuration:

```
variable "input" {
    default = "Hello world"
}

output "notsensitive" {
    value = "${var.input}"
}

output "sensitive" {
    sensitive = true
    value = "${var.input}"
}
```

Would result in the output:

```
terraform apply

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

  notsensitive = Hello world
  sensitive    = <sensitive>
```

The `terraform output` command continues to display the value as before.

Limitations: Note that sensitivity is not tracked internally, so if the
output is interpolated in another module into a resource, the value will
be displayed. The value is still present in the state.
2016-05-09 15:46:07 -04:00
Mårten Gustafson 5b7f12ecd7 Tweak docs to properly document .tfvars format (#6415)
As reported and described in hashicorp/terraform#3292
2016-04-29 14:06:36 +01:00
David Glasser 6cf06bb3ab config: new interpolation function jsonencode 2016-03-29 07:38:58 -07:00
Paul Hinze 293c6ca68c Revert "Revert "core: Add uuid() interpolate function.""
This reverts commit 661be01d9b.
2016-03-21 15:14:30 -05:00
Paul Hinze 661be01d9b Revert "core: Add uuid() interpolate function." 2016-03-15 18:39:34 -05:00
Paul Hinze 1e0b8ea478 core: Add uuid() interpolate function.
Utilizes hashicorp's go-uuid library for proper random seeding setup.
2016-03-10 18:39:07 -06:00
gamename c6b350b98e docs(variables): describe order of evaluation with files 2016-03-01 17:08:57 -06:00
Radek Simko bb5af50b25 docs: Document new interpolation function md5 2016-02-24 13:01:05 +00:00
Radek Simko b90cd618c2 docs: Sort interpolation functions alphabetically 2016-02-24 13:01:05 +00:00
Feanil Patel 8fbacf7261 Fix -module-depth typo
The module depth parameter had an equal sign instead of a dash in the name.
2016-02-23 20:02:36 -05:00
Paul Hinze a7b8a54a83 website: clarify `file()` base location
refs #5213
2016-02-19 09:56:55 -06:00
Radek Simko 14e6f6e4ce docs: Clarify example usage of the signum function 2016-02-07 20:28:58 +00:00
Radek Simko 4edf782260 Merge pull request #4854 from jfromaniello/add_signum_interpolation
Add signum interpolation function
2016-02-07 19:44:16 +00:00
Radek Simko 1018af5662 config: Add docs for new base64sha256 func 2016-01-30 13:19:10 +01:00
Colin Hebert d92d205dd9 rename trim to trimspace 2016-01-30 20:51:28 +11:00
Colin Hebert f5074cd521 Add the trim() interpolation function 2016-01-30 10:28:04 +11:00
José F. Romaniello c8795b8565 Add signum interpolation function
This function returns -1 for negative numbers, 0 for 0 and 1 for positive numbers.

Useful when you need to set a value for the first resource and a different value for the rest of the resources.

Example: `${element(split(",", var.r53_failover_policy), signum(count.index))}`
2016-01-27 12:49:52 -03:00
Paul Hinze 0b11ace9ac Merge pull request #4788 from hashicorp/phinze/skip-remote-test-option
tests: allow opt-out of remote tests via env var
2016-01-25 10:57:08 -06:00
James Nugent cb6cb8b96a core: Support explicit variable type declaration
This commit adds support for declaring variable types in Terraform
configuration. Historically, the type has been inferred from the default
value, defaulting to string if no default was supplied. This has caused
users to devise workarounds if they wanted to declare a map but provide
values from a .tfvars file (for example).

The new syntax adds the "type" key to variable blocks:

```
variable "i_am_a_string" {
    type = "string"
}

variable "i_am_a_map" {
    type = "map"
}
```

This commit does _not_ extend the type system to include bools, integers
or floats - the only two types available are maps and strings.

Validation is performed if a default value is provided in order to
ensure that the default value type matches the declared type.

In the case that a type is not declared, the old logic is used for
determining the type. This allows backwards compatiblity with previous
Terraform configuration.
2016-01-24 11:40:02 -06:00
Paul Hinze 6bafa74011 tests: allow opt-out of remote tests via env var
Adds the `TF_SKIP_REMOTE_TESTS` env var to be used in cases where the
`http.Get()` smoke test passes but the network is not able to service
the needs of the tests.

Fixes #4421
2016-01-21 15:44:18 -06:00
James Nugent 5c16b47330 Merge pull request #4765 from hashicorp/f-docs-operators
docs: Add operators for interpolation functions
2016-01-20 17:09:45 -05:00
James Nugent efe27f3eae docs: Add operators for interpolation functions 2016-01-20 16:28:07 -05:00
Paul Hinze e67fc0fe9b command: Change module-depth default to -1
This means that terraform commands like `plan`, `apply`, `show`, and
`graph` will expand all modules by default.

While modules-as-black-boxes is still very true in the conceptual design
of modules, feedback on this behavior has consistently suggested that
users would prefer to see more verbose output by default.

The `-module-depth` flag and env var are retained to allow output to be
optionally limited / summarized by these commands.
2016-01-20 13:58:02 -06:00
Matt Moyer c17a6ceb2a Add a sha256(...) interpolation function. 2016-01-16 23:54:04 +00:00
Seth Vargo 8dbc43639d Use HTTPS + www. for links 2016-01-14 16:03:26 -05:00
William Holroyd 7b962006fb Update interpolation.html.md
Small changes to case on interpolation syntaxes, dealing with case.
2016-01-10 22:39:20 -05:00
Joseph Kordish 21fe576cb5 added the function to the docs 2016-01-06 15:19:54 -06:00
clint shryock c94b7c4584 provider/aws: Update docs with t1 instance for accounts with EC2 Classic 2015-12-21 10:00:34 -06:00
clint shryock 6236e8d720 Update doc to use valid AMI and t2.micro instance types 2015-12-15 15:58:28 -06:00
Paul Hinze bd23ab35bf docs: update template_file examples
Use the new non-deprecated style.

refs #4025
2015-11-24 09:01:11 -06:00
Matt Morrison 6ecec7fe83 Add coalesce func 2015-11-08 19:34:56 +13:00
f440 983e07cc17 docs: Correct logging option example
ref. 0090c063e8
2015-10-29 18:56:40 +09:00
Martin Atkins ef161e1c1b Various interpolation functions for CIDR range manipulation.
These new functions allow Terraform to be used for network address space
planning tasks, and make it easier to produce reusable modules that
contain or depend on network infrastructure.

For example:
- cidrsubnet allows an aws_subnet to derive its
  CIDR prefix from its parent aws_vpc.
- cidrhost allows a fixed IP address for a resource to be assigned within
  an address range defined elsewhere.
- cidrnetmask provides the dotted-decimal form of a prefix length that is
  accepted by some systems such as routing tables and static network
  interface configuration files.

The bulk of the work here is done by an external library I authored called
go-cidr. It is MIT licensed and was implemented primarily for the purpose
of using it within Terraform. It has its own unit tests and so the unit
tests within this change focus on simple success cases and on the correct
handling of the various error cases.
2015-10-22 08:10:52 -07:00
Matt Morrison cccc5d03e3 Add lower / upper interpolation functions 2015-10-21 08:16:24 -07:00
Rob Zienert a1939e70f7 Adding ignore_changes lifecycle meta property 2015-10-14 16:34:27 -05:00
Anthony Stanton b62833e7b8 Add documentation for compact() 2015-10-11 16:47:48 +02:00