Commit Graph

21632 Commits

Author SHA1 Message Date
Chris Marchesi d7048cb640
helper/schema: ResourceDiff ForceNew attribute correctness
A couple of bugs have been discovered in ResourceDiff.ForceNew:

* NewRemoved is not preserved when a diff for a key is already present.
This is because the second diff that happens after customization
performs a second getChange on not just state and config, but also on
the pre-existing diff. This results in Exists == true, meaning nil is
never returned as a new value.
* ForceNew was doing the work of adding the key to the list of changed
keys by doing a full SetNew on the existing value. This has a side
effect of fetching zero values from what were otherwise undefined values
and creating diffs for these values where there should not have been
(example: "" => "0").

This update fixes these scenarios by:

* Adding a new private function to check the existing diff for
NewRemoved keys. This is included in the check on new values in
diffChange.
* Keys that have been flagged as ForceNew (or parent keys of lists and
sets that have been flagged as ForceNew) are now maintained in a
separate map. UpdatedKeys now returns the results of both of these maps,
but otherwise these keys are ignored by ResourceDiff.
* Pursuant the above, values are no longer pushed into the newDiff
writer by ForceNew. This prevents the zero value problem, and makes for
a cleaner implementation where the provider has to "manually" SetNew to
update the appropriate values in the writer. It also prevents
non-computed keys from winding up in the diff, which ResourceDiff
normally blocks by design.

There are also a couple of tests for cases that should never come up
right now involving Optional/Computed values and NewRemoved, for which
explanations are given in annotations of each test. These are here to
guard against future regressions.
2018-04-08 07:50:41 -07:00
Andrew Bloomgarden d9b315564e tools/terraform-bundle: compress files in the generated zip file
The FileInfoHeader method does not compress files by default.
2018-04-06 19:16:25 -07:00
James Bardin fdc74f96cc
Merge pull request #17789 from hashicorp/jbardin/travis
update travis to go1.10.1
2018-04-05 16:23:19 -04:00
James Bardin fdbd153449 update CHANGELOG.md
Fix link formatting from script
Add missing entry
2018-04-05 16:14:58 -04:00
James Bardin 58c4504148 release: clean up after v0.11.6 2018-04-05 19:42:26 +00:00
James Bardin dbce85d85f
v0.11.6 2018-04-05 19:25:37 +00:00
James Bardin 967a688f22 update travis to go1.10.1 2018-04-05 15:09:09 -04:00
Dominik-K 9da5f5a9f0 docs: no interpolations in `lifecycle` attribute (#3116) (#17695)
* docs: interpolations in `lifecycle` unsupported currently
2018-04-05 15:06:22 -04:00
James Bardin bfbab7100c update CHANGELOG.md 2018-04-05 14:28:27 -04:00
James Bardin 2f8532407a
Merge pull request #17071 from MarkFreebairn/Issue-16360-empty-target-points-to-all-resources-in-state
command: Fix #16360 - Fail fast if -target is specified but empty
2018-04-05 14:19:32 -04:00
James Bardin 79d0a5c4a4
Merge pull request #17788 from hashicorp/jbardin/communicators
get errors from winrm commands
2018-04-05 13:05:13 -04:00
James Bardin dc8c1534fe udpate winrmcp 2018-04-05 12:54:58 -04:00
James Bardin abfb43555a connect communicator during Start
Match the tested behavior, and that of the ssh implementation, where the
communicator automatically connects when starting a command.

Remove unused import from legacy dependency handling.
2018-04-05 12:54:58 -04:00
James Bardin 82a4552030 use Run instead of Shell.Execute in winrm
The error from a remote command is not exported, and only exposed via
the Run method. Otherwise the Run method works exactly like the
runCommand function being removed.
2018-04-05 12:54:58 -04:00
James Bardin 3c30f04e0e fix ssh logging
Ensure correct formatting and add a log level to all output.
2018-04-05 12:54:58 -04:00
James Bardin d12a387cb6 update CHANGELOG.md 2018-04-05 12:29:15 -04:00
James Bardin 060a3bc6d2
Merge pull request #17748 from reancloud/winrm-ntlm
Support NTLM for WinRM communicators.
2018-04-05 09:44:11 -04:00
James Bardin 61eae050ab
Merge pull request #17588 from creack/creack/fix-deepcopy-type
Fix issue with deepcopy returning wrong type causing panic
2018-04-05 09:24:08 -04:00
James Bardin f62ef7677c
Merge pull request #17618 from outsideris/fix-registry-document-parameter
website: remove an unnecessary parameter for API
2018-04-05 08:54:14 -04:00
James Bardin f8b691f743
Merge pull request #17781 from hashicorp/jbardin/habitat
`enable` habitat supervisor service before `start`
2018-04-05 08:43:50 -04:00
James Bardin c1edaadc7b
Merge pull request #17403 from rwc/hab-provisioner-updates
[provisioner-habitat] Fix package channel honoring and documentation
2018-04-04 16:55:24 -04:00
Marko Springfeldt a201b04b26 `enable` habitat supervisor service before `start`
Signed-off-by: Arash Zandi <arash.zandi@smartb.eu>
2018-04-04 16:51:26 -04:00
James Bardin f51879b4f9
Merge pull request #17496 from normanjoyner/bugfix/cloud-index-grammar
fix grammar in description
2018-04-04 16:43:18 -04:00
James Bardin 16d0e1225c
Merge pull request #17776 from haines/s3-backend-docs
Add required DynamoDB IAM permissions for state locking to S3 backend docs
2018-04-04 15:32:46 -04:00
James Bardin 9bf9280c03
Merge pull request #17431 from oscr/use-seekstart
Use io.SeekStart instead of deprecated os.SEEK_SET
2018-04-04 15:27:24 -04:00
James Bardin da3b4e9abc
Merge pull request #17734 from scottwinkler/master
Keep permissions when copying file for Linux
2018-04-04 15:25:25 -04:00
James Bardin a75e9ed9c1
Merge pull request #17766 from stack72/manta-backend-force-directory-structure
backend/manta: Add support for manta backend tiered path structure
2018-04-04 15:22:11 -04:00
James Bardin f25718b065
Merge pull request #17768 from hashicorp/jbardin/unused-destroy-outputs
unused outputs in a destroy should be pruned
2018-04-04 15:20:12 -04:00
James Bardin 6c56ac7f82
Merge pull request #17771 from hashicorp/jbardin/cbd-warning
remove old warning care create_before_destroy
2018-04-04 15:19:47 -04:00
James Bardin 8a3f347076
Merge pull request #17772 from hashicorp/jbardin/module-alias
update missing alias message
2018-04-04 15:19:23 -04:00
James Bardin d345732b3c
Merge pull request #17527 from ryosan-470/fix-old-completion-config
Remove old completion file for zsh
2018-04-04 15:11:04 -04:00
Andrew Haines b6fbb42be6
Add required DynamoDB IAM permissions for state locking to S3 backend docs 2018-04-04 10:38:52 +01:00
Andrew Haines 6c2b2515bd
Update reference to deprecated argument in S3 backend docs 2018-04-04 09:20:08 +01:00
James Bardin 7b5efad725 update missing alias message
Update the old error message for a missing provider alias, as we no
longer automatically inherit providers.
2018-04-03 17:40:36 -04:00
James Bardin ff8d02cd25 remove old warning care create_before_destroy
Create-before-destroy dependencies are automatically ordered correctly
by terraform. Remove the old notice about requiring all dependencies to
have the same setting for create_before_destroy.
2018-04-03 17:37:36 -04:00
James Bardin 620f1985a1 unused outputs in a destroy should be pruned
During a full destroy when outputs are removed, the
NodeDestroyableOutput was preventing it's sibling output from being
destroyed. Prune the output node if it only has its destroy node as a
dependent.

The destroy output test is simply run a second time with no state, which
would cause the output interpolation to fail if it remained in the
graph.
2018-04-03 13:19:04 -04:00
James Bardin e493407e7e
Merge pull request #17765 from hashicorp/jbardin/scale-in-multi-var
detect scaled in resources when evaluating *s
2018-04-03 13:12:35 -04:00
stack72 df9b2913ae backend/manta: Add support for manta backend tiered path structure
This was already added to triton-go and is now making its way to
the manta backend

```
% acctests backend/remote-state/manta
=== RUN   TestBackend_impl
--- PASS: TestBackend_impl (0.00s)
=== RUN   TestBackend
--- PASS: TestBackend (27.36s)
=== RUN   TestBackendLocked
--- PASS: TestBackendLocked (16.24s)
=== RUN   TestRemoteClient_impl
--- PASS: TestRemoteClient_impl (0.00s)
=== RUN   TestRemoteClient
--- PASS: TestRemoteClient (3.40s)
=== RUN   TestRemoteClientLocks
--- PASS: TestRemoteClientLocks (7.17s)
PASS
ok  	github.com/hashicorp/terraform/backend/remote-state/manta
```
2018-04-03 17:32:10 +03:00
James Bardin 79b948c9cc detect scaled in resources when evaluating *s
If an existing resources is scaled back to 0, locals and outputs will
still have a multi-variable reference to evaluate, which should return
an empty list. Due to how the resource is removed, the resource will
still exist in the state but with no primary instance, which needs to be
ignored in the instance count.
2018-04-03 10:00:45 -04:00
Chris Marchesi db5ed51703
Merge pull request #17667 from hashicorp/f-resource-diff-getokexists-computed
helper/schema: Add Computed to ResourceDiff, expose GetOkExists
2018-04-02 07:32:04 -07:00
Joe Khoobyar 138e64dee0 more unit tests 2018-03-30 22:05:10 -04:00
Joe Khoobyar 9766cc0aa5 added unit tests 2018-03-30 22:01:49 -04:00
Joe Khoobyar 481be9da35 code reformatted with gofmt 2018-03-30 21:45:09 -04:00
Joe Khoobyar d7cb9baa43 cleaner initialization of winrmcp 2018-03-30 21:32:46 -04:00
Joe Khoobyar 852a74c49d first attempt at supporting NTLM authentication in Terraform 2018-03-30 21:11:53 -04:00
James Bardin d8b9337c08
Merge pull request #17744 from hashicorp/jbardin/retry-ssh-auth
retry ssh authentication failures
2018-03-30 16:36:07 -04:00
James Bardin 943972cd8f retry ssh authentication failures
Most of the time an ssh authentication failure would be non-recoverable,
but some host images can start the ssh service before it is properly
configured, or before user authentication data is available.

Log ssh authentication errors and allow the provisioner to retry until
the connection timeout.
2018-03-30 15:23:24 -04:00
Martin Atkins 0deb6e8a7f
Update CHANGELOG.md 2018-03-30 09:18:09 -07:00
Paul Tyng 6a4dc38971
Update CHANGELOG.md 2018-03-30 11:16:19 -04:00
Paul Tyng 3837d0792a
Merge pull request #17738 from alewando/conflicts_with_leaking_sensitive_data
Remove attribute value from ConflictsWith validation message (leaks sensitive data)
2018-03-30 11:14:56 -04:00