Commit Graph

24050 Commits

Author SHA1 Message Date
Radek Simko 81c20ed7ae
configupgrade: Improve error message formatting 2019-05-13 13:14:59 +01:00
James Bardin d495fb5b35
Merge pull request #21274 from hashicorp/jbardin/validate-integers
validate integers when using protoV5
2019-05-11 09:50:36 -04:00
James Bardin fd67d6e605
Merge pull request #21273 from hashicorp/jbardin/auto-remote-attributes
remove extra attributes from state during upgrade
2019-05-11 09:46:52 -04:00
James Bardin 6bc36d3321 validate integers when using protoV5
The new type system only has a Number type, but helper schema
differentiates between Int and Float values. Verify that a new config
value is an integer during Validate, because the existing WeakDecode
validation will decode a float value into an integer while the config
FieldReader will attempt to parse the float exactly.

Since we're limiting this to protoV5, we can be certain that any valid
config value will be converted to an `int` type by the shims. The only
case where an integral float value will appear is if the integer is out
of range for the systems `int` type, but we also need to prevent that
anyway since it would fail to read in the same manner.
2019-05-11 09:34:28 -04:00
James Bardin b7ff04f1b6 remove extra attributes from state during upgrade
Terraform core would previously ignore unexpected attributes found in
the state, but since we now need to encode/decode the state according
the schema, the attributes must match the schema.

On any state upgrade, remove attributes no longer present in the schema
from the state. The only change this requires from providers is that
going forward removal of attribute is considered a schema change, and
requires an increment of the SchemaVersion in order to trigger the
removal of the attributes from state.
2019-05-10 18:05:41 -04:00
Martin Atkins 28b2383eac
Link to later v0.11.x releases on the v0.11 maintenance branch 2019-05-09 15:54:29 -07:00
Martin Atkins c6e32f148d website: v0.12 upgrade guide revisions preparing for final release
Our original upgrade guide was drafted while some things were still in
flux and not all of our upgrade tooling was in place yet.

This redraft now attempts to be more specific and direct, showing exact
commands to run and (where relevant) exact error messages that Terraform
might return.

I also took this opportunity for some general copy-editing, though we'll
probably want to do one more pass of that alone (without changing any
content at the same time) before final release.

This new content presumes the existence of a Terraform v0.11.14 release,
which isn't published yet at the time of writing but should be published
before v0.12.0 final, once we've done final verification and review of
the upgrade path including it.
2019-05-09 12:20:24 -07:00
Paul Tyng 3bc99857fc
Merge pull request #21259 from hashicorp/b/test-conformance
Fix incorrect direction of TestConformance
2019-05-09 14:33:58 -04:00
Paul Tyng 15f7f8049f
Fix incorrect direction of TestConformance 2019-05-09 09:16:54 -04:00
Alexis 00cc5781ab website: Fix typo in the configuration language introduction page 2019-05-08 16:31:37 -07:00
Chris Griggs ee5d4698a2
Merge pull request #21250 from hashicorp/cgriggs01-community-providers
[Website] New community providers
2019-05-08 11:22:08 -07:00
cgriggs01 8c52fdcecf new community providers 2019-05-08 11:13:19 -07:00
Justin Weissig aa4c43b341 website: Fix typo on the "expressions" documentation page 2019-05-08 10:58:22 -07:00
Martin Atkins c46f036b29 release: clean up after v0.12.0-rc1 2019-05-07 18:47:08 +00:00
Martin Atkins 66c5acffa6
v0.12.0-rc1 2019-05-07 18:29:46 +00:00
James Bardin 02781206ff
Merge pull request #21223 from hashicorp/jbardin/unknown-computed
restrict the ComputedKeys usage to containers
2019-05-07 08:36:47 -04:00
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
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