Commit Graph

24822 Commits

Author SHA1 Message Date
Martin Atkins bf661d54fc
Update CHANGELOG.md 2019-06-04 09:25:39 -07:00
Martin Atkins b1213f7f6c backend/local: don't panic when an instance has only a deposed object
This unusual situation isn't supposed to arise in normal use, but it can
come up in practice in some edge-case scenarios where Terraform fails in
a severe way during a create_before_destroy.

Some earlier versions of Terraform also had bugs in their handling of
deposed objects, so this may also arise if upgrading from one of those
older versions with some leftover deposed objects in the state.
2019-06-04 09:23:29 -07:00
Kristin Laemmert 2d194828a4
Merge pull request #21576 from hashicorp/mildwonkey/b-matchkeys
lang/funcs: fix error when `matchkeys` encountered a variable
2019-06-04 12:19:09 -04:00
Kristin Laemmert c163ba71db simplify 2019-06-04 11:54:26 -04:00
Kristin Laemmert 30a924e162 lang/funcs: `matchkeys` - unify type for keys and searchset
Added higher-level test for matchkeys to exercise mixing
types in searchset. This had to be in the functions tests so the HCL
auto conversion from tuple to list would occur.
2019-06-04 08:57:02 -04:00
Chris Griggs c281f70662
Merge pull request #21578 from hashicorp/cgriggs01-community-links
[Website] new community links + update signalFX
2019-06-03 19:47:06 -05:00
cgriggs01 55fe3c7a28 new community links + update signalFX 2019-06-03 17:19:52 -07:00
David Liao 97ad35f90c website: Update taint command docs to reflect new 0.12 usage 2019-06-03 15:36:38 -07: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 f2a14d7c18 lang/funcs: fix error when `matchkeys` encountered a variable
`matchkeys` was returning a (false) error if the searchset was a
variable, since then the type of the keylist and searchset parameters
would not match.

This does slightly change the behavior: previously matchkeys would
produce an error if the parameters were not of the same type, for e.g.
if searchset was a list of strings and keylist was a list of integers.
  This no longer produces an error.
2019-06-03 18:00:53 -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 2b200dd9bb re-validate data source config during read
Just like resources, early data soruce validation will contain many
unknown values. Re-validate once we have the config config.
2019-06-01 11:40:54 -04:00
James Bardin c41eb0e6e4 re-validate config during Plan
The config is statically validated early on for structural issues, but
the provider can't validate any inputs that were unknown at the time.
Run ValidateResourceTypeConfig during Plan, so that the provider can
validate the final config values, including those interpolated from
other resources.
2019-06-01 11:09:48 -04:00
Justin Dearing 5bcbe008e0
Updated docs for using az cli or service principle
Using az login and then terraform init from the command line I got `Error: Either an Access Key / SAS Token or the Resource Group for the Storage Account must be specified`
2019-05-31 23:22:11 -04:00
James Bardin c658fe173a test a dynamic block with MinItems in the schema
A dynamic block is always going to be a single value during validation,
but should not fail when min-items > 1 is specified.
2019-05-31 20:07:41 -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
Cory Watson fe5729ea83
Update link to official SignalFx provider
We've folded Yelp's provider into an official provider!
2019-05-28 09:15:45 -07: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
Masayuki Morita ac83827c90 states/statefile: decode backend hash as uint64
Fixes #21478

In #19688, `terraform.BackendState.Hash` was fixed.
We also need to fix `states/statefile.backendStateV2.Hash`
2019-05-28 23:59:36 +09: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