Commit Graph

26599 Commits

Author SHA1 Message Date
James Bardin 4185aa93f5 doc typo 2020-02-13 21:27:35 -05:00
James Bardin 85ebaac8ce update provider types in tests 2020-02-13 21:15:11 -05:00
James Bardin 691bb6b907 use CreateBeforeDestroy from state
If the resource was stored as CreateBeforeDestroy, use the same ordering
regardless.

This reversal will be taken care if more cleanly in state-only destroys,
and with less risk. Don't use this commit as-is.
2020-02-13 21:09:59 -05:00
James Bardin a44cf03eaa test for CBD instance being removed entirely
Even though this is only the destroy half of CreateBeforeDestroy, the
resource may still require the same destroy order.
2020-02-13 21:04:56 -05:00
James Bardin d2a9dd3cef don't override CreateBeforeDestroy from diff
If the Diff is only a delete action, we can't override
CreateBeforeDestroy, because it will always be false and prevent the
stored state value from being used.
2020-02-13 21:04:56 -05:00
James Bardin dd8ab5812e add CreateBeforeDestroy to state
Added to src and object, but still need serialization and tests.
2020-02-13 21:04:56 -05:00
James Bardin ded207f3b8
Merge pull request #24083 from hashicorp/jbardin/state-only-destroys
Instance state only destroys
2020-02-13 21:03:10 -05:00
James Bardin 37e60cd883 fix comment text 2020-02-13 20:46:48 -05:00
Chris Griggs be72d59e6d
Merge pull request #24104 from hashicorp/cgriggs01-community-providers
[Website] Adding community providers
2020-02-13 14:14:50 -08:00
James Bardin b4f06c22fe fixup provider types in new tests 2020-02-13 16:05:28 -05:00
James Bardin 099806c128 fixup LocalProviderConfig literal 2020-02-13 15:43:52 -05:00
James Bardin d4d99be2db remove some destroy special cases
We no longer need special cases for most things during a full destroy,
so remove those from the graph transformations.

The only remaining cases are:
 - remove the root outputs, so destroy ends up with a clean state
 - reverse the target deps when targeting a destroy.
2020-02-13 15:43:52 -05:00
James Bardin 8c5853ee4e remove old references code from abstract resource 2020-02-13 15:43:52 -05:00
James Bardin ca5b0e6894 no longer need DestroyValueReferenceTransformer
since destroy nodes are no longer connected to values, there's no need
to try and wrangle their edges to prevent cycles during destroy.
2020-02-13 15:43:52 -05:00
James Bardin dc8cdd260c add missing deps to targeted destroy test 2020-02-13 15:43:52 -05:00
James Bardin a4bc91abeb remove invalid destroy provisioner tests
Remove all the destroy provisioner tests that are testing what is no
longer allowed.

Add missing state dependencies to remaining tests that require it.
2020-02-13 15:43:52 -05:00
James Bardin 9edb719aaa run AttachStateTransformer in destroy plan
The AttachStateTransformer was never run in the destroy plan. This means
that resource without configuration that used a non-default provider
would not be connected to the correct provider for the plan.

The test that was attempting to catch this only worked because the
temporary graph used in the DestroyEdgeTransformer would add the state
and detect some issues.
2020-02-13 15:43:19 -05:00
James Bardin a0ba481cad add state where it's now needed for tests 2020-02-13 15:42:10 -05:00
James Bardin 4a41af08b8 new deps are more precise 2020-02-13 15:42:10 -05:00
James Bardin 681d197628 fix DestroyEdgeTransformer tests
The tests require working node implementations with real state.
2020-02-13 15:42:10 -05:00
James Bardin b5517b53ec simplify CBD transformation
Start by removing the DestroyEdge type altogether. This is only used to
detect the natural edge between a resource's create and destroy nodes,
but that's not necessary for any transformations. The custom edge type
also interferes with normal graph manipulations, because you can't
delete an arbitrary edge without knowing the type, so deletion of the
edge based only on the endpoints is often done incorrectly. The dag
package itself does this incorrectly in TransitiveReduction, which
always assumes the BasicEdge type.

Now that inter-resource destroy dependencies are already connected in the
DestroyEdgeTransformer (from the stored deps in state), there's no need
to search out all dependant resources in the CBD transformation, as they
should all be connected. This makes the CBD transformation rule quite
simple: reverse any edges from create nodes.
2020-02-13 15:42:10 -05:00
James Bardin 84d1f5c688 convert destroy provisioner warnings to errors 2020-02-13 15:42:10 -05:00
James Bardin 451190a5e6 remove DestroyEdge
This special edge type is no longer used. While we still have the option
of encoding more meaning into the edged themselves, having one special
edge type used only in one specific case was easily overlooked, as
dag.BasicEdge is assumed in all other cases.
2020-02-13 15:42:10 -05:00
James Bardin 8b5522a090 do not attempt to find more destroy dependencies
The requires destroy dependencies are what is stored in the state, and
have already been connected. There is no need to search further, since
new nodes from the config may interfere with the original destroy
ordering.
2020-02-13 15:42:10 -05:00
James Bardin 45f2a61bdb do not connect references from destroy nodes
Destroy nodes only require their own state to evaluate. Do not connect
any of their references in the graph.
2020-02-13 15:42:10 -05:00
Kristin Laemmert 47a16b0937
addrs: embed Provider in AbsProviderConfig instead of Type
a large refactor to addrs.AbsProviderConfig, embedding the addrs.Provider instead of a Type string. I've added and updated tests, added some Legacy functions to support older state formats and shims, and added a normalization step when reading v4 (current) state files (not the added tests under states/statefile/roundtrip which work with both current and legacy-style AbsProviderConfig strings).

The remaining 'fixme' and 'todo' comments are mostly going to be addressed in a subsequent PR and involve looking up a given local provider config's FQN. This is fine for now as we are only working with default assumption.
2020-02-13 15:32:58 -05:00
Kristin Laemmert 6b3debb8ff
Changelog cleanup for 0.13 (#24108)
* Changelog cleanup for 0.13
2020-02-13 15:19:31 -05:00
Alisdair McDiarmid 12e090ce48 command/login: Fix browser launcher for WSL users
With the current implementation of terraform login, Windows Subsystem
for Linux fails to open a browser due to lack of support for xdg-open.
This commit reuses a fix from pkg/browser#8 which detects a WSL
environment and uses cmd.exe to open the URL instead.
2020-02-13 15:02:40 -05:00
Pam Selle 4cfdec7694
Update to 0.13 version (#24106) 2020-02-13 14:45:22 -05:00
Chris Griggs 099f6430ea [Website] Adding community providers 2020-02-13 09:55:36 -08:00
Li Kexian 76e5b446ba
backend/cos: Add TencentCloud backend cos with lock (#22540)
* add TencentCloud COS backend for remote state

* add vendor of dependence

* fixed error not handle and remove default value for prefix argument

* get appid from TF_COS_APPID environment variables
2020-02-13 11:37:11 -05:00
Kristin Laemmert 7bd662d587
Update CHANGELOG.md 2020-02-12 14:57:24 -05:00
Kristin Laemmert 1c7167a9a1
command/import: remove -provider command line argument (#24090)
Now that #22862 has been merged, terraform will properly pick up the
resource provider configuration from state. We can remove the deprecated
`-provider` flag.
2020-02-12 14:45:41 -05:00
Kristin Laemmert 80862f3436
command/import: attach references before validating provider (#22862)
There was an order-of-operations bug where the import graph builder was
validating that the provider did not have any resource references before
references were actually being attached. This PR fixes the order of
operations and adds a test (in the command package).

Fixes #22804
2020-02-12 14:00:08 -05:00
James Bardin a765d69fb0
Merge pull request #24032 from hashicorp/jbardin/map-funcs
make the merge function more precise
2020-02-12 10:51:05 -05:00
Kristin Laemmert 378b6515bf
Update CHANGELOG.md 2020-02-12 10:35:51 -05:00
Li Kexian f3bbe8d33f
command/workspace delete: release lock after workspace removal warning (#24085) 2020-02-12 10:34:51 -05:00
Pierre Carles b956e8ef35
Fix negative parallelism and negative semaphore (#23902)
* Throw an error when parallelism <=0

* Panic in case of negative semaphore
2020-02-12 10:10:52 -05:00
Fábio Matavelli aefdef1044 Add missing host to communicator test 2020-02-12 10:49:58 +00:00
Fábio Matavelli 48c187efe8 Add invalid host test 2020-02-12 10:07:17 +00:00
Fábio Matavelli 18f72b1cb7 Fix communicator test 2020-02-12 10:06:30 +00:00
Fábio Matavelli c9ea93308a ssh: return error if host is empty 2020-02-11 21:18:04 +00:00
Kristin Laemmert 851e6dcdbb
configs: added map to configs.Module for provider local name lookup (#24039)
* configs: added map of ProviderLocalNames to configs.Module

We will need to lookup any user-supplied local names for a given FQN.
This PR adds a map of ProviderLocalNames to the Module, along with
adding tests for this and for decodeRequiredProvidersBlock.

This also introduces the appearance of support for a required_provider
"source" attribute, but ignores any user-supplied source and instead
continues to assume that addrs.NewLegacyProvider is the way to go.
2020-02-11 13:17:37 -05:00
Pam Selle 7e76ce33a9
Merge pull request #24072 from rccrdpccl/master
Minor spelling fix
2020-02-10 15:17:23 -05:00
Riccardo Piccoli 094ed0ff4d spelling fix 2020-02-10 18:55:20 +01:00
James Bayer 7b8604bd0d
website/docs: Fixed w in VMware to lower case (#24065) 2020-02-10 09:30:52 -05:00
Steve Ortiz 75ef3548f7
website: update community provider links (#23839) 2020-02-06 21:59:25 -08:00
Alisdair McDiarmid afd792dc27
Merge pull request #24048 from hashicorp/alisdair/terraform-logout
command/logout: Add terraform logout command
2020-02-06 15:59:29 -05:00
Alisdair McDiarmid 7ff58780d4 Remove unnecessary type assertion checks
The type assertion checks on the credentials source are unnecessary, and
the alternative code path they allow would panic.
2020-02-06 15:30:49 -05:00
Alisdair McDiarmid 325f8a84f8 command/logout: Exit early if already logged out 2020-02-06 15:00:55 -05:00