Commit Graph

24297 Commits

Author SHA1 Message Date
David Celis 5ccccfb91f
Remove pre-alpha cost estimation logic 2019-05-20 16:48:38 -07:00
Justin Weissig 778cae91a8 website: fix typo in the 'terraform' block documentation page 2019-05-20 14:37:03 -07:00
Martin Atkins fe8c380fe1 website: Remove the Sentinel section from 0.12 upgrade guide
A longer-form guide will follow in the Sentinel section of the Terraform
Enterprise documentation, once it's ready. For now, this section isn't
saying anything useful since it was always just a stub for a guide we
planned to write later.
2019-05-20 14:16:56 -07:00
Martin Atkins f199030739 Changelog consolidate for the v0.12.0 final release 2019-05-17 15:22:44 -07:00
Martin Atkins 5af8bcff2f
website: correct the synopsis on the formatdate function page
Was using "format" instead of "formatdate".
2019-05-17 14:42:00 -07:00
Matt Morrison cbebb7cdf1 command/init: Don't panic if go-getter-fetched module has version constraint 2019-05-17 13:19:31 -07:00
Martin Atkins 742deca3e9 lang/funcs: Short-circuit if start or end index is unknown
Previously the type-selection codepath for an input tuple referred
unconditionally to the start and end index values. In the Type callback,
only the types of the arguments are guaranteed to be known, so any access
to the values must be guarded with an .IsKnown check, or else the function
will not short-circuit properly when an unknown value is passed.

Now we will check the start and end indices are in range when we have
enough information to do so, but we'll return an approximate result if
either is unknown.
2019-05-17 08:48:02 -07:00
Peter 02d03d2d25 website: Fix odd spacing on the provider configuration syntax page 2019-05-17 08:45:08 -07:00
James Bardin 1c77704a3b
Merge pull request #21341 from hashicorp/jbardin/update-go-cty
Fix inconsistent element types with tuple literals
2019-05-16 17:07:16 -04:00
James Bardin 1d134fea69 update go-cty 2019-05-16 16:43:28 -04:00
James Bardin c391f3a1a3 failing test for cty conversion bug 2019-05-16 16:40:17 -04:00
Martin Atkins 11cf8fd6be vendor: go get github.com/hashicorp/hcl2@master
This fixes a bug where HCL would flag a parse error if a single-line
comment appeared at the end of a file without a terminating newline.
2019-05-16 07:30:50 -07:00
Martin Atkins 32d19b9574 website: 0.12 upgrade guide about variable type constraints
The upgrade tool is assuming that a type of "list" means list(string) and
a type of "map" means map(string), because that was what we documented
those as meaning.

In practice, Terraform 0.11 was lacking some validation which allowed
more complex nested structures in some cases even though they were pretty
inconvenient to use due to other language limitations.

The upgrade tool doesn't have enough context to make a reliable decision
on this, so instead we'll rely on the upgrade guide for this. We don't
need a TF-UPGRADE-TODO comment in this case because we reserve those for
things where a subsequent operation might cause the configuration to be
misinterpred, rather than just causing an error. Instead, we'll show an
example of the comment in the upgrade guide so the reader can easily
match it, and give some advice in the guide on how to address it.
2019-05-16 07:29:42 -07:00
Martin Atkins 004c2056a7 configs/configupgrade: Use single-line syntax for empty object exprs 2019-05-16 07:29:42 -07:00
Radek Simko 12f7ac1374
command/format: Reduce extra whitespaces & new lines 2019-05-16 14:52:06 +01:00
Kevin Hicks 68a2249581
Fix GitLab title on providers index 2019-05-15 14:42:17 -05:00
Martin Atkins bec4641867 core: Don't panic if NodeApplyableResourceInstance has no config
This is a "should never happen" case, because we shouldn't ever have
resources in the plan that aren't in the configuration, but since we've
got a report of a crash here (which went away before we got a chance to
debug it) here's just an extra guard to ensure that we'll still exit
gracefully in that case.

If we see this error crop up again in future, it'd be nice to gather a
full trace log so we can see what GraphNodeAttachResourceConfig did and
why it did not attach a configuration.
2019-05-14 16:54:12 -07:00
James Bardin 80ffe0c9fe
Merge pull request #21305 from hashicorp/jbardin/always-upgrade
always run UpgradeResourceState
2019-05-14 18:50:00 -04:00
Martin Atkins 63fa1ac418 vendor: go get github.com/hashicorp/hcl2@master
This includes a small fix to ensure the parser doesn't produce an invalid
body for block parsing syntax errors, and instead produces an incomplete
result that calling applications like Terraform can still analyze.

The problem here was affecting our version-constraint-sniffing code, which
intentionally tried to find a core version constraint even if there's a
syntax error so that it can report that a new version of Terraform is a
likely cause of the syntax error. It was working in most cases, unless
it was the "terraform" block itself that contained the error, because then
we'd try to analyze a broken hcl.Block with a nil body.

This includes a new test for "terraform init" that exercises this
recovery codepath.
2019-05-14 15:37:46 -07:00
James Bardin b9e5745b3c remove SkipCoreTypeCheck and LegacySchema
Update the test provider to match the sdk.
2019-05-14 18:19:18 -04:00
James Bardin c9e1d26c25 remove the legacy schema access
Having removed the methods, it is straightforward to mechanically update
this file to get rid of all references to the "legacy schema". There is
now only one config schema type to deal with in the sdk.
2019-05-14 18:12:57 -04:00
James Bardin c8a2f3840b remove SkipCoreTypeCheck
This experiment is no longer needed for handling computed blocks, since
the legacy SDK can't reasonably handle Dynamic types, we need to remove
this before the final release.

Remove LegacySchema functions as well, since handling SkipCoreTypeCheck
was the only thing left they were handling.
2019-05-14 18:05:30 -04:00
James Bardin 059dcf1e25 implement UpgradeResourceState in the mock provider
The default is a Noop that simply encodes the provided state
2019-05-14 18:00:01 -04:00
James Bardin ec65fb960d sdk: use core schema for json state upgrade
When handling the json state in UpgradeResourceState, the schema
must be what core uses, because that is the schema used for
encoding/decoding the json state.

When converting from flatmap to json state, the legacy schema will be
used to decode the flatmap to a cty value, but the resulting json will
be encoded using the CoreConfigSchema to match what core expects.
2019-05-14 17:59:45 -04:00
Chris Griggs e0cec2075e
Merge pull request #21302 from hashicorp/cgriggs01-stable
[Cherry-pick] Rancher2 links
2019-05-14 13:26:18 -07:00
Chris Griggs 4db9b40471
Merge pull request #21301 from hashicorp/cgriggs01-rancher2
[Website] Rancher2 provider doc links
2019-05-14 13:25:52 -07:00
Kristin Laemmert 3c83f14884
Update CHANGELOG.md 2019-05-14 16:21:22 -04:00
Kristin Laemmert 14d625c850
configs/configupgrade: preserve in-line comments for lists (#21299)
* configs/configupgrade: preserve in-line comments for lists

The configupgrade tool was not writing `LineComments` for lists. Now it
is!

Fixes #21155
2019-05-14 16:19:31 -04:00
cgriggs01 80c0af894b [Website] Rancher2 provider links 2019-05-14 11:14:32 -07:00
cgriggs01 dc4811f898 [Website] Rancher2 provider links 2019-05-14 11:13:32 -07:00
Martin Atkins bcf2aa06dd core: Call providers' UpgradeResourceState every time
Previously we tried to short-circuit this if the schema version hadn't
changed and we were already using JSON serialization. However, if we
instead call into UpgradeResourceState every time we can let the provider
or the SDK do some general, systematic normalization and cleanup steps
without always requiring a schema version increase.

What exactly would be fixed up this way is for the SDK to decide, but for
example the SDK might choose to automatically delete from the state
anything that is no longer present in the schema, avoiding the need to
write explicit state migration functions for that common case where the
remedy is always the same.

The actual update logic is delegated to the provider/SDK intentionally so
that it can evolve over time and potentially differ depending on how
each SDK thinks about schema.
2019-05-14 13:30:42 -04:00
Martin Atkins abdd680fd2 website: Special considerations about the "scp-like" git address syntax
We've seen in the past that some users try to use this form with the
ssh:// URL prefix, so we'll mention explicitly that this is invalid and
show a working example of how to use it without the URL scheme prefix.
2019-05-14 07:38:06 -07:00
Martin Atkins f5a7f45ffb internal/initwd: Fix module installation error
The "err" variable in the MaybeRelativePathErr condition was masking the
original err with nil in the "else" case of this branch, causing the
error message to be incomplete.

While here, also tweaked the wording to say "Could not download" rather
than "Error attempting to download", both to say the same thing in fewer
words and because the summary line above already starts with "Error:"
when we print out this message, so it looks weird to have both lines
start with the same word.
2019-05-14 07:38:06 -07:00
Martin Atkins 038621a8ed vendor: go get github.com/hashicorp/go-getter@v1.3.0
This includes a fix for the handling of Git-over-SSH URLs with explicit
port numbers.
2019-05-14 07:38:06 -07:00
James Bardin ea6b5b010a
Merge pull request #21291 from hashicorp/jbardin/read-empty-containers
only hold back empty container changes in apply
2019-05-13 19:20:07 -04:00
James Bardin cf61a689eb only hold back empty container changes in apply
When normalizing the state during read, if the resource was previously
imported, most nil-able values will be nil, and we need to prefer the
values returned by the latest Read operation. This didn't come up
before, because Read is usually working with a state create by plan and
Apply which has already shaped the state with the expected empty values.

Having the src value preferred only during Apply better follows the
intent of this function, which should allow Read to return whatever
values it deems necessary. Since Read and Plan use the same
normalization logic, the implied Read before plan should take care of any
perpetual diffs.
2019-05-13 19:04:25 -04:00
Radek Simko a2ee9fc8f9
Merge pull request #21282 from hashicorp/configupgrade-err-msg-fmt
configupgrade: Improve error message formatting
2019-05-13 16:17:30 +01:00
Radek Simko 499134178f
Merge pull request #21284 from hashicorp/stringer-update
stringer: Regenerate files with latest version
2019-05-13 16:16:58 +01:00
Radek Simko 2aa5394092
travis: Bump go to 1.12.4 2019-05-13 15:55:43 +01:00
Radek Simko 8a6d1d62b6
stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
Radek Simko 67defb768e
go-version: Bump to 1.12.4 2019-05-13 15:34:21 +01:00
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