Commit Graph

23656 Commits

Author SHA1 Message Date
James Bardin 565eeac5d1
Merge pull request #20041 from hashicorp/jbardin/shims
Some fixes for the provider shims
2019-01-17 19:34:54 -05:00
James Bardin c045d3e6a3 disable known failing tests
We need these changes in master for testing, worry about these test
after.
2019-01-17 19:19:13 -05:00
James Bardin 286cb0a39d clean out diff a little more before checking
Check if there wasn't any real diff attributes first, before returning
the original state in PlanResourceChange.
2019-01-17 19:19:13 -05:00
James Bardin 4f691c5988 don't replace null strings with empty strings
This adds unexpected values in some cases, and since the case this
handles is only within set objects, we'll deal woth this when tackling
the sets themselves.
2019-01-17 19:19:13 -05:00
James Bardin 2cc651124e don't overwrite values in plan
Plan can change known values too, which we can't match in sets. We'll
find another way to normalize these eithout losing plan values.
2019-01-17 18:51:18 -05:00
James Bardin 4439a7dcf4 add tests for nested default values
Don't lose default values set within a nested block.
2019-01-17 18:51:18 -05:00
Martin Atkins 176a5abfd3 command: Restore single-file support in "terraform fmt"
This possibility was lost in the rewrite to use HCL2, but it's used by
a number of external utilities and text editor integrations, so we'll
restore it here.

Using the stdin/stdout mode is generally preferable for text editor use
since it allows formatting of the in-memory buffer rather than directly
the file on disk, but for editors that don't have support for that sort of
tooling it can be convenient to just launch a single command and directly
modify the on-disk file.
2019-01-17 14:21:18 -08:00
Martin Atkins b0a43cab84 command: "terraform fmt" must fail if file has invalid syntax
Since the HCL formatter only works with tokens, it can in principle be
called with any input and produce some output. However, when given invalid
syntax it will tend to produce nonsensical results that may drastically
change the input file and be hard for the user to undo.

Since there's no strong reason to try to format an invalid or incomplete
file, we'll instead try parsing first and fail if parsing does not
complete successfully.

Since we talk directly to the HCL API here this is only a _syntax_ check,
and so it can be applied to files that are invalid in other ways as far
as Terraform is concerned, such as using unsupported top-level block types,
resource types that don't exist, etc.
2019-01-17 14:21:18 -08:00
Martin Atkins a10f9a18cf vendor: go get github.com/zclconf/go-cty@master
There are no code changes in this update. This just catches up with the
latest master commit in the upstream repo, which has only seen
documentation updates since the prior commit.
2019-01-17 14:21:18 -08:00
Martin Atkins 787c176063 vendor: go get github.com/hashicorp/hcl2@master
This includes a missing feature for the splat syntax (null.* returns an
empty tuple) and also fixes a bug in the source code formatter where it
was inserting spaces between two consecutive interpolation sequences, like
"${foo}${bar}".
2019-01-17 14:21:18 -08:00
Kim Ngo b88ef2b47c
Update CHANGELOG.md 2019-01-17 12:09:13 -06:00
Martin Atkins 6ab15a80a4
Update CHANGELOG.md 2019-01-17 10:03:30 -08:00
Martin Atkins 2f8f7d6f4d lang/funcs: Type conversion functions
It's not normally necessary to make explicit type conversions in Terraform
because the language implicitly converts as necessary, but explicit
conversions are useful in a few specialized cases:

- When defining output values for a reusable module, it may be desirable
  to force a "cleaner" output type than would naturally arise from a
  computation, such as forcing a string containing digits into a number.
- Our 0.12upgrade mechanism will use some of these to replace use of the
  undocumented, hidden type conversion functions in HIL, and force
  particular type interpretations in some tricky cases.
- We've found that type conversion functions can be useful as _temporary_
  workarounds for bugs in Terraform and in providers where implicit type
  conversion isn't working correctly or a type constraint isn't specified
  precisely enough for the automatic conversion behavior.

These all follow the same convention of being named "to" followed by a
short type name. Since we've had a long-standing convention of running all
the words together in lowercase in function names, we stick to that here
even though some of these names are quite strange, because these should
be rarely-used functions anyway.
2019-01-17 10:01:47 -08:00
Kim Ngo ba6e243bd9
Merge pull request #20030 from findkim/bump-plugin-install-version
Bump provider installer protocol version to 5
2019-01-17 11:37:48 -06:00
Radek Simko 5d4946e27a
Merge pull request #20004 from hashicorp/issue-template-labels
Add labels to issue templates
2019-01-17 15:22:49 +00:00
Radek Simko b661a983b8
Add labels to issues templates 2019-01-17 15:04:16 +00:00
findkim 073d367018 tools/terraform-bundle: match plugin installer protocol with terraform's installer 2019-01-16 16:15:52 -06:00
findkim 7816e61614 Bump installer protocol version to 5 and separate client and server protocol references 2019-01-16 15:07:57 -06:00
Radek Simko 2ad9f0513a
Update CHANGELOG.md 2019-01-16 19:31:28 +00:00
Radek Simko aaf4319953
Merge pull request #20005 from hashicorp/b-statemgr-avoid-html-escaping
states/statemgr: Avoid HTML escaping when printing LockInfo
2019-01-16 19:30:50 +00:00
Martin Atkins 4e14ab7557 config: Remove "setproduct" function, which is now in lang/funcs 2019-01-16 09:57:16 -08:00
Martin Atkins da51e72cbb lang/functions: set functions from cty
The sethaselement, setintersection, and setunion functions are defined in
the cty stdlib. Making them available in Terraform will make it easier to
work with sets, and complement the currently-Terraform-specific setproduct
function.

In the long run setproduct should probably move into the cty stdlib too,
but since it was submitted as a Terraform function originally we'll leave
it here now for simplicity's sake and reorganize later.
2019-01-16 09:57:16 -08:00
Martin Atkins edb5f82de1 lang/funcs: Convert the "setproduct" function to the new approach
In our new world it produces either a set of a tuple type or a list of a
tuple type, depending on the given argument types.

The resulting collection's element tuple type is decided by the element
types of the given collections, allowing type information to propagate
even if unknown values are present.
2019-01-16 09:57:16 -08:00
Martin Atkins 9d11d427a8 config: Rename "product" function to "setproduct"
This hopefully makes it clearer that it works with sets rather than real
numbers, avoiding confusion with "sum", "min", "max", etc.
2019-01-16 09:57:16 -08:00
Fábio Matavelli acd17d9075 Create product interpolation function
This creates the product interpolation function that returns the cartesian product of a list of lists.
2019-01-16 09:57:16 -08:00
Kim Ngo 2bca828e46
Merge pull request #20015 from findkim/rm-dup-discovery-logging
Remove duplicate discovery logging
2019-01-15 16:12:54 -06:00
findkim abeb86072b Remove duplicate logging 2019-01-15 15:39:28 -06:00
James Bardin 30eead2df5
Merge pull request #20012 from hashicorp/jbardin/nested-set-shims
Fix shims with deeper nested containers
2019-01-15 15:40:16 -05:00
Riley Karson 74ec68f9d4 Fix Google Cloud Platform name across docs.
The `google` provider supports GCP, not necessarily Google Cloud as a whole.

Update the naming on this index page to match [the provider README](https://github.com/terraform-providers/terraform-provider-google#terraform-provider-for-google-cloud-platform) and the [provider docs changes](https://github.com/terraform-providers/terraform-provider-google/blob/master/website/docs/index.html.markdown#google-cloud-platform-provider) coming in the next release.
2019-01-15 12:10:20 -08:00
appilon c5e4ac9b7c
Merge pull request #20013 from appilon/go1.11.4
Require go1.11.4
2019-01-15 15:00:36 -05:00
Alex Pilon 9929bd05a3
update vagrantfile for go1.11.4 2019-01-15 14:31:51 -05:00
Alex Pilon de769533e1
require go1.11.4 2019-01-15 14:26:21 -05:00
James Bardin 7d05dee08d refactor ApplyResourceChange
Remove a bunch of indentation by returning early, and make sure we don't
fail on non-fatal error without saving the applied value.
2019-01-15 12:35:58 -05:00
James Bardin 0a731167db add a round trip through the shims during apply
Cycle through the shim operations after Apply, to ensure that we can
converge on a stable value for for Plan. While the shims produce valid
values in both directions, helper/schema sometimes does not agree on
which containers should be empty or null.
2019-01-15 11:59:15 -05:00
James Bardin 0d1252812b add more tests for a computed nested list and set 2019-01-15 11:55:02 -05:00
Radek Simko a29daf0176
Update CHANGELOG.md 2019-01-15 16:26:01 +00:00
Radek Simko cb39836705
Merge pull request #19995 from hashicorp/f-cmd-fmt-reduce-diff
command/format: Reduce whitespaces in empty fields
2019-01-15 16:25:19 +00:00
Sander van Harmelen 9ba5b1b507
Merge pull request #20010 from hashicorp/svh/f-remote-backend
backend/remote: use the correct test operation
2019-01-15 16:37:09 +01:00
Sander van Harmelen e08a7e979e backend/remote: use the correct test operation 2019-01-15 16:13:16 +01:00
Sander van Harmelen 4d9da13d85 go-mod: update dependencies 2019-01-15 15:52:37 +01:00
Radek Simko 13896d72c5
command/format: Render empty object as {} 2019-01-15 14:34:49 +00:00
Radek Simko 5f14b7a7f2
command/format: Render empty primitive list/set as [] 2019-01-15 14:34:49 +00:00
Radek Simko 09d19ca9d9
command/format: Render empty JSON object as {} 2019-01-15 14:34:48 +00:00
Radek Simko 0dd2d56f18
command/format: Render empty maps as {} 2019-01-15 14:34:46 +00:00
Radek Simko ea05da89cb
states/statemgr: Avoid HTML escaping when printing LockInfo 2019-01-15 10:57:31 +00:00
Martin Atkins 0995559934 go mod tidy 2019-01-14 17:39:16 -08:00
Kim Ngo 41a2376915
Merge pull request #19981 from findkim/colorize-protocol-mismatch-msg
Condense protocol mismatch UI error message
2019-01-14 15:12:09 -06:00
findkim 6e0de3e3f5 Nest incompatible provider protocol error to include dynamic custom msg 2019-01-14 14:56:47 -06:00
Radek Simko 1c660cc39f
Update CHANGELOG.md 2019-01-14 20:34:28 +00:00
Radek Simko aae87c7921
Merge pull request #19990 from hashicorp/f-cmd-fmt-ignore-empty-str
command/format: Ignore removal of empty strings
2019-01-14 20:33:43 +00:00