Commit Graph

24138 Commits

Author SHA1 Message Date
James Bardin ac2219ba6e don't lose Private state data during copy
Fix the scope of the private data copy in DeepCopy.

Make sure Dependencies matches nil vs empty so that Equal compares
correctly between copied states
2019-06-05 19:22:46 -04:00
James Bardin dcab82e897 send and receive Private through ReadResource
Send Private data blob through ReadResource as well. This will allow for
extra flexibility for future providers that may want to pass data out of
band through to their resource Read functions.
2019-06-03 18:08:26 -04:00
James Bardin e2b2f1bbbc add Private fields to ReadResource
Private data was previously created during Plan, and sent back to the
provider during Apply. This data also needs to be persisteded accross
Read calls, but rather than rely on core for that we can send the data
to the provider during Read to allow for more flexibilty.
2019-06-03 18:01:34 -04:00
Kristin Laemmert e9e718b318
command/show (-json): fix panic if a moduleCall has a nil config (#21569)
In the unlikely event that a moduleCall has a nil config - for example,
if a nested module call includes a variable with a typo in an
attribute - continue gracefully.

This is an unusual edge case in the category of "probably should not happen", caused by
#21568
2019-06-03 13:04:21 -05:00
Kristin Laemmert 06a3333316 note: this is an unusual edgecase in the category of "probably should not happen"
If https://github.com/hashicorp/terraform/issues/21543 is
fixed, we can remove this check.
2019-06-03 14:00:46 -04:00
Martin Atkins 7dfdcb9c2d
Update CHANGELOG.md 2019-06-03 09:49:19 -07:00
Martin Atkins e85093ce08 configs/configload: Don't panic when version constraint is added
Previously, adding a version constraint to a module that was previously
recorded without a version in the module manifest would cause a panic.

Instead, we now use a slight variant of the "dependencies have changed"
error that doesn't try to print out a specific version number.
2019-06-03 09:45:30 -07:00
Martin Atkins c5285021fa internal/initwd: Test that version is rejected for local modules
This was already working, but since that codepath is separate from the
go-getter install codepath it's helpful to have a separate test for it,
in addition to the existing one for go-getter modules.
2019-06-03 09:45:30 -07:00
Kristin Laemmert 703f024cbd command/show (-json): fix panic if a moduleCall has a nil config
In the unlikely event that a moduleCall has a nil config - for example,
if a nested module call includes a variable with a typo in an
attribute - continue gracefully.
2019-06-03 11:19:03 -04:00
Kristin Laemmert ab9e98da3c
Update CHANGELOG.md 2019-06-03 08:15:29 -04:00
Kristin Laemmert 65fc037ecb
command/show (plan -json): fix panic (#21541)
* command/show -json: fix panic

afterUnknown should return only bools, not values.

* command/jsonplan: let's delete some redundant code!

the plan output was somewhat inconsistent with return values for
"after_unknown". This strives to fix that. If all "after" values are
known, return an empty object instead of iterating over values.

Also fixing some typos and general copypasta.
2019-06-03 07:14:23 -05:00
James Bardin ebc2e5fb56
Merge pull request #21549 from hashicorp/jbardin/empty-dynamic-attr
allow empty dynamic blocks with ConfigModeAttr
2019-06-01 12:01:49 -05:00
James Bardin 0133dda311 allow empty dynamic blocks with ConfigModeAttr
If a dynamic block is evaluated zero times, the body content will
contain 0 blocks. Allow the probe for ConfigModeAttr to accept that no
blocks with a matching attribute should still be converted to a block if
they are called with dynamicExpand.
2019-05-31 16:31:24 -05:00
Martin Atkins 6e5c6cbdea
Update CHANGELOG.md 2019-05-31 09:45:11 -07:00
Martin Atkins 55794eb658 lang/funcs: Don't panic when distinct called with empty list 2019-05-31 11:44:31 -05:00
enm10k 8118bf8d93 Fix a broken link in CHANGELOG.md (#21508) 2019-05-29 16:49:53 -05:00
James Bardin 7f5ffbfe90
Merge pull request #21439 from hashicorp/jbardin/init-backend
init always prompts for migration with most remote backend configurations
2019-05-29 16:01:40 -05:00
James Bardin ad883c6c50
Merge pull request #21443 from hashicorp/jbardin/unknowns-in-validation
filter unknowns from simple lists and maps in sdk
2019-05-29 15:59:49 -05:00
James Bardin 06dfc4abd8 allow setting -backend-config='' to unset override
There is currently no way to unset -backend-config during init, since
not setting that option assumes the user will use the saved config.
Allow setting `-backend-config=""` to specify no overrides.
2019-05-29 12:58:04 -05:00
Martin Atkins ff9235c464 build: remove Vagrantfile
This Vagrantfile hasn't been maintained for a long time and no longer
produces a correct and functioning development environment for Terraform.

Terraform's development environment is a pretty standard Go development
environment, so a custom VM setup for development is overkill. Maintaining
the Makefile and other similar dev environment helpers is already overhead
enough, and having this stale Vagrantfile here was occasionally causing
folks to try to use it and get frustrated that it didn't work.
2019-05-28 19:35:34 -07:00
Martin Atkins d512584497 command/jsonplan: Don't panic with mixtures of known/unknown/empty
The omitUnknowns and unknownAsBool functions were previously trying hard
to preserve the same collection types in the output as they had in the
input, by attempting to keep everything matched up so that the results
would be valid.

Unfortunately, this turns out to be a harder problem than we originally
thought: it was possible for a collection value going in to produce
inconsistent element types out (and thus a panic) in the following
situations:
- when a collection with mixed known and unknown values was passed in
  to omitUnknowns.
- when a collection of collections where the inner collections are a
  mixture of empty and not empty in unknownAsNull.

The results of these functions are only used to marshal to JSON anyway,
and JSON serialization can't distinguish between the three sequence types
or the two mapping types, so in practice we can just standardize on
converting all sequences to tuple and all mappings to object here and not
change the resulting output at all, and then we don't have to worry about
making sure all of the inner types get preserved exactly.

A nice consequence of that relaxation is that we can now do what we
originally wanted to do with unknownAsBool, and omit map keys and
object attributes altogether if their values would've been false,
producing a much more compact result. This is easiest to do now when
there's only one known user of this JSON plan output, and we know that
user will treat both false and omitted as the same here.
2019-05-28 19:33:21 -07:00
Brian Flad 3865b74780
Merge pull request #21122 from fbcbarbosa/patch-1
Document AWS_SDK_LOAD_CONFIG on s3 backend
2019-05-28 21:05:40 -05:00
Kristin Laemmert 9869fbc5c4
core: don't panic in NodeAbstractResourceInstance References() (#21445)
* core: don't panic in NodeAbstractResourceInstance References()

It is possible for s.Current to be nil. This was hard to reproduce, so
the root cause is still unknown, but we can guard against the symptom.

* add log statement
2019-05-28 17:27:38 -04:00
Radek Simko d3506b774f
Merge pull request #21476 from hashicorp/vendor-go-cmp
vendor: github.com/google/go-cmp@v0.3.0
2019-05-28 10:42:51 -05:00
James Bardin 6055cb632e filter unknowns from simple lists and maps in sdk
While there was already a check in the sdk to filter unknowns from
validation, it missed the case where those were in simple lists and maps.
2019-05-28 09:58:07 -04:00
Mateusz Gozdek b6de825723 backend/gcs: make Unlock error message more clear 2019-05-27 20:07:14 -07:00
Radek Simko 02437f067e
vendor: github.com/google/go-cmp@v0.3.0 2019-05-27 20:35:42 -05:00
Radek Simko f3fb3f8ccf
Merge pull request #21470 from hashicorp/vendor-go-mock
vendor: github.com/golang/mock@v1.3.1
2019-05-27 20:24:56 -05:00
Radek Simko 37f19cb9f5
vendor: github.com/golang/mock@v1.3.1 2019-05-27 12:22:03 +01:00
James Bardin c017149b31 don't store prepared backend config
The backend gets to "prepare" the configuration before Configure is
called, in order to validate the values and insert defaults. We don't
want to store this value in the "config state", because it will often
not match the raw config after it is prepared, forcing unecessary
backend migrations during init.

Since PrepareConfig is always called before Configure, we can store the
config value directly, and assume that it will be prepared in the same
manner each time.
2019-05-24 14:51:18 -04:00
James Bardin ee9a618369 don't migrate backend during init without override
If the backend config hashes match during init, and there are no new
backend override options, then we assume the existing config is OK.
Since init should be idempotent, we should be able to run init with no
options or config changes, and not effect the backends at all.
2019-05-24 11:31:04 -04:00
Joe Tavin 2c176fdf4b website/0.12 upgrade: Fix typo (#21426) 2019-05-24 10:06:01 -04:00
James Bardin cefc927e48 failing test for backend re-init 2019-05-23 18:21:52 -04:00
Sander van Harmelen f68673fbe4
Update CHANGELOG.md 2019-05-23 14:38:20 +02:00
Sander van Harmelen 486b8167f3
Update CHANGELOG.md 2019-05-23 14:36:53 +02:00
Sander van Harmelen 8fd3aa91a0
Merge pull request #21234 from hashicorp/svh/f-init-v0.12
Always try to select a workspace after initialization (v0.12)
2019-05-23 14:34:31 +02:00
Radek Simko 5f2970309e
Merge pull request #21397 from Norbinsh/master
Fix invalid URL
2019-05-23 07:24:46 +01:00
Shay Elmualem 9be5d99a92
Fix invalid URL 2019-05-23 09:07:50 +03:00
Martin Atkins c7c69a5e99 release: clean up after v0.12.0 2019-05-22 20:28:49 +00:00
Martin Atkins 08918475dd
v0.12.0 2019-05-22 20:14:35 +00:00
Martin Atkins 896f849201
Correct some links in the v0.12.0 changelog
In rewriting them from their previous internal links to GitHub renderings, I neglected to remove the .md suffixes.
2019-05-22 12:44:18 -07:00
Chris Marchesi 91f1489b86
Merge pull request #21390 from hashicorp/website-add-sentinel-012-upgrade-guide-details
website: add Sentinel 0.12 upgrade guide details
2019-05-22 10:58:58 -07:00
Chris Marchesi 340aa7c598
website: add Sentinel 0.12 upgrade guide details
This adds details for using Sentinel in Terraform 0.12. It largely
links to the corresponding guide in the Terraform Enterprise
documentation.
2019-05-22 09:58:18 -07:00
James Bardin 233115ad4b
Merge pull request #21380 from hashicorp/b-always-write-state-version
always write the current state terraform_version
2019-05-21 20:11:43 -04:00
James Bardin 1e1dcfd95a always write the current state terraform_version
Any time a new state is written, the current terraform version should be
recorded.
2019-05-21 18:55:53 -04:00
Justin Weissig 7335f1fdc8 docs: fixed typo (#21297)
Spelling: varable/variable.
2019-05-21 15:55:44 -04: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