Commit Graph

25749 Commits

Author SHA1 Message Date
Brian Flad 00a76d019a
Merge pull request #18614 from craigatgoogle/float-validation
Added FloatBetween validation function.
2019-05-06 17:56:56 -07:00
James Bardin 7075bc9a4d restrict the ComputedKeys usage to containers
Computed primitive values must see the UnknownConfigValue or they are
assumed to be unchanged. Restrict the usage of the protov5 ComputedKeys
to containers.
2019-05-06 19:19:10 -04:00
Chris Griggs 9c4ff517b6
Merge pull request #21221 from hashicorp/cgriggs01-vmware
[Website] Add VMware vRA7 provider links
2019-05-06 15:57:34 -07:00
Nick Fagerlund a48566a34f
Merge pull request #21220 from hashicorp/may19_unlinked
(website) Adjust intro of attr-blocks page
2019-05-06 14:37:19 -07:00
Nick Fagerlund 0172fed7d4 (website) Adjust intro of attr-blocks page
- Note that we intentionally omitted it from the sidebar, to reduce confusion.
- Write a summary up top so you can stop reading sooner if you don't actually need this.
2019-05-06 13:07:54 -07:00
cgriggs01 3911b0f310 [Website] add vra7 links 2019-05-06 12:33:21 -07:00
James Bardin 325344beaf
Merge pull request #21169 from sixcorners/master
Don't leak so many connections in the pg backend
2019-05-05 09:40:59 -04:00
James Bardin 094c06df1d
Merge pull request #21209 from hashicorp/jbardin/computeds-in-config-shim
more precise handling of ComputedKeys in config
2019-05-05 09:25:47 -04:00
James Bardin 8250b2e4de more precise handling of ComputedKeys in config
With the new ConfigModeAttr, we can now have complex structures come in
as attributes rather than blocks. Previously attributes were either
known, or unknown, and there was no reason to descend into them. We now
need to record the complete path to unknown values within complex
attributes to create a proper diff after shimming the config.
2019-05-05 09:02:33 -04:00
Martin Atkins 083af21d30 providers/terraform: Explicit validate step
We were previously catching some errors at read time, but some type errors
were panicking because the cty.DynamicPseudoType arguments have no
automatic pre-type-checking done but this code was assuming they would
be objects.

Here we add an explicit validation step that includes both the backend
validation we were previously doing during read and some additional
type checking to ensure the two dynamic arguments are suitably-typed.
Having the separate validation step means that these problems can be
detected by "terraform validate", rather than only in "terraform plan"
or "terraform apply".
2019-05-04 21:06:31 -07:00
Martin Atkins d06edb1b62 go get github.com/hashicorp/hcl2@master
This corrects a bug in the HCL 2 scanner where a $ or % symbol would cause
incorrect tokenization if appearing immediately before a " .

This also includes some updates to Go extension libraries that the HCL
update brings in. Some of these changes update to support Unicode 11, but
only when compiling with Go 1.13, so we won't see the effect of these
changes until we start building Terraform with Go 1.13.
2019-05-03 15:29:40 -07:00
James Bardin dcdc36e2fd
Merge pull request #21202 from hashicorp/jbardin/data-plan
core:  always re-read datasource when the dependencies have changes
2019-05-03 17:29:55 -04:00
James Bardin 06babb6cc3 remove dead code for the next reader 2019-05-03 17:29:16 -04:00
James Bardin 35e087fe5b always re-read datasource if there are dep changes
If a datasource's dependencies have planned changes, then we need to
plan a read for the data source, because the config may change once the
dependencies have been applied.
2019-05-03 17:29:16 -04:00
James Bardin f9dfa98533 test to make sure a data source is planned
The data source here needs to be re-read during apply, because its
config is changing.
2019-05-03 16:25:37 -04:00
Kristin Laemmert b66d03bba7
Mildwonkey/upgrade doc remote backend (#21201)
* website/upgrade-guides: init -reconfigure is required with remote backend

* build: add a real and useful version of `.tfdev`
2019-05-03 15:34:54 -04:00
matt short cb20438221
added type to variable
the other variables have a type, i think this one might be missing
2019-05-03 08:22:07 +01:00
James Bardin 133d3d7971 check for computed values in the config
First check the ComputedValues field in the config when reading config
field, so that we can detect if there is an unknown value in a
container. Since maps, lists and sets are verified to exist by looking
for a "length" first, an unknown config value in the config is ignored.
2019-05-02 14:08:40 -07:00
James Bardin 43f0468829 fix ComputedKeys for nested blocks in shimmed cfg
The indexes were added out of order in the attribute keys
2019-05-02 14:08:40 -07:00
Martin Atkins 332010fd56 plans/objchange: Fix handling of dynamic block placeholders
If a dynamic block (in the HCL dynamic block extension sense) has an
unknown value for its for_each argument, it gets expanded to a single
placeholder block with all of its attributes set to a unknown values.

We can use this as part of a heuristic to relax our object compatibility
checks for situations where the plan included an object that appears to
be (but isn't necessarily) such a placeholder, allowing for the fact that
the one placeholder block could be replaced with zero or more real blocks
once the for_each value is known.

Previously our heuristic was too strict: it would match only if the only
block present was a dynamic placeholder. In practice, users may mix
dynamic blocks with static blocks of the same type, so we need to be more
liberal to avoid generating incorrect incompatibility errors in such
cases.
2019-05-02 14:08:40 -07:00
Martin Atkins 95826d6fdd vendor: github.com/hashicorp/hcl2@master
This contains an adjustment to how the dynamic blocks extension expands
a dynamic block whose for_each expression is unknown: it now produces an
block whose leaf attributes are all unknown, which is what Terraform had
previously been expecting but it wasn't actually true in practice.
2019-05-02 14:08:40 -07:00
Chris Griggs fc4c8b00bf
Merge pull request #21191 from hashicorp/cgriggs01-community
[Website] two new community providers
2019-05-02 12:33:48 -07:00
cgriggs01 dc889c4f08 two new community providers 2019-05-02 11:01:08 -07:00
Kristin Laemmert b1d0b1383f
lang/funcs: remove sethaselement function and documentation (#21164)
`contains` and `sethaselement` are effectively the same function, and
`contains` works with `sets` thanks to automatic HCL conversion.
2019-05-02 10:47:19 -04:00
James Bardin d2bc9ca406
Merge pull request #21174 from hashicorp/jbardin/func-types
lang/funcs: better type handling in interpolation funcs
2019-05-02 09:24:36 -04:00
Chris Griggs c5a2e922ce
Merge pull request #21175 from hashicorp/cgriggs01-guide-changes
[Website] Terraform Provider Development Guide changes
2019-05-01 17:18:05 -07:00
Chris Griggs a0cd6156d1
Add to section 3 2019-05-01 15:16:25 -07:00
James Bardin 3ab496d4b1 allow sets and tuples in contains function
Sets are no longer going to be automatically converted, so we need to
handle those in contains.
2019-05-01 18:13:06 -04:00
James Bardin 19bddee11b more precise types handling in coalescelist
coalescelist should accept lists and tuples, and return a dynamic types
when the arguments are not homogeneous.
2019-05-01 18:03:10 -04:00
Chris Griggs 68847ac99b
Fixes grammer and spelling 2019-05-01 14:06:26 -07:00
James Bardin d186d3a490 update slice test 2019-05-01 16:57:31 -04:00
James Bardin 359f057a16 allow chunklist to handle unknowns
Chunklist should be able to return chunks containing unknown values.
2019-05-01 16:57:31 -04:00
James Bardin 93ef015336 more precise type handling in flatten
FlattenFunc can return lists and tuples when individual elements are
unknown. Only return an unknown tuple if the number of elements cannot
be determined because it contains an unknown series.

Make sure flatten can handle non-series elements, which were previously
lost due to passing a slice value as the argument.
2019-05-01 16:57:31 -04:00
James Bardin 81e04c3050 more precise type handling in slice
When slicing a list containing unknown values, the list itself is known,
and slice should return the proper slice of that list.

Make SliceFunc return the correct type for slices of tuples, and
disallow slicing sets.
2019-05-01 16:57:02 -04:00
cgriggs01 4194eff5da guide changes 2019-05-01 13:40:50 -07:00
Kristin Laemmert 543e279cb0
Update CHANGELOG.md 2019-05-01 10:20:57 -04:00
Kristin Laemmert 8520f4e4a5
* lang/funcs/flatten: accept sets and tuples, return tuples
* lang/funcs: flatten should handle sets and tuples

* flatten now returns a tuple
2019-05-01 10:19:40 -04:00
Stephen Buergler fc5b186e8d Don't leak so many connections in the pg backend
This change fixes an error I get:
Error: pq: too many connections for role "asdf"
because I can only have so many connections.
2019-04-30 23:34:51 -05:00
Martin Atkins 6adcc7ab73 vendor: go get github.com/zclconf/go-cty@master
cty now guarantees that sets of primitive values will iterate in a
reasonable order. Previously it was the caller's responsibility to deal
with that, but we invariably neglected to do so, causing inconsistent
ordering. Since cty prioritizes consistent behavior over performance, it
now imposes its own sort on set elements as part of iterating over them so
that calling applications don't have to worry so much about it.

This change also causes cty to consistently push unknown and null values
in sets to the end of iteration, where before that was undefined. This
means that our diff output will now consistently list additions before
removals when showing sets, rather than the ordering being undefined as
before.

The ordering of known, non-null, non-primitive values is still not
contractually fixed but remains consistent for a particular version of
cty.
2019-04-30 15:49:28 -07:00
James Bardin 4b83ddb025
Merge pull request #21165 from hashicorp/jbardin/go-plugin
update go-plugin
2019-04-30 17:40:34 -04:00
James Bardin bf0fb89a2a update go-plugin
Includes fix for correct plugin server log levels, preventing everything
from logging to Debug.
2019-04-30 17:20:10 -04:00
Kristin Laemmert 66068a5462
Update CHANGELOG.md 2019-04-30 15:59:18 -04:00
Kristin Laemmert d7dda4e436
states/statefile: upgrade legacy dependency syntax (#21159)
We used to allow "foo.1" etc as a reference, but now it's "foo[1]".
2019-04-30 14:34:01 -04:00
Pam Selle 02850111b9
Merge pull request #21156 from jweissig/patch-2
Fixed typo
2019-04-30 10:45:34 -04:00
Radek Simko 0471a92865
Update CHANGELOG.md 2019-04-30 13:08:08 +01:00
Justin Weissig 299e0432bc
Fixed typo
Fixed typo: cafeful/careful.
2019-04-30 00:06:01 -07:00
Sander van Harmelen fc5f74a7d5
Update CHANGELOG.md 2019-04-29 21:38:00 +02:00
Sander van Harmelen 36b03b7a13
Merge pull request #21148 from hashicorp/svh/f-locks
backend/remote: do not unlock after a failed upload
2019-04-29 21:36:57 +02:00
Sander van Harmelen 394f20f59c backend/remote: do not unlock after a failed upload
When changes are made and we failed to upload the state, we should not
try to unlock the workspace. Leaving the workspace locked is a good
indication something went wrong and also prevents other changes from
being applied before the newest state is properly uploaded.

Additionally we now output the lock ID when a lock or force-unlock
action failed.
2019-04-29 21:23:33 +02:00
James Bardin 30199600eb
Merge pull request #21146 from hashicorp/jbardin/grpc-test-server
Stop grpc server when running ACC tests
2019-04-29 14:33:44 -04:00