Commit Graph

25489 Commits

Author SHA1 Message Date
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
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
Alisdair McDiarmid 081f02971d command/logout: Add terraform logout command
Use terraform logout to remove stored credentials for a remote service
host.
2020-02-06 15:00:55 -05:00
Kristin Laemmert 1b1327ce45
Update CHANGELOG.md 2020-02-06 12:51:31 -05:00
James Goodhouse 25bfe7337b
lang: add setsubtract function (#23424)
* add setdifference and setsubtract functions and docs
* remove setdifference as it is not implemented correct in underlying lib

* Update setintersection.html.md
* Update setproduct.html.md
* Update setunion.html.md
2020-02-06 12:49:11 -05:00
Kristin Laemmert b4f21b6044 terraform: fix issue merging provider version constraints
A bug in ConfigTreeDependencies, where a pointer was being updated
instead of the map value, meant that only the first provider config
version constraing to be processes was being stored. This fixes that
bug, so now the returned moduledeps.Providers could have multiple
version constraints.

The responsibility for resolving provider version selection continues to
lie in the command package's ProviderResolver (under plugins.go).
2020-02-06 11:28:48 -05:00
Kristin Laemmert c242f9389d terraform: look up provider fqns from
configs.Module.ProviderRequirements

This is close to a no-op - we aren't accepting the provider source
attribute yet, so the only entires in the ProviderRequirements will
already be legacy provider addrs.

This PR also removes the unused `uid` field from ResourceProvider and
ResourceProvisioner. It's unused now and even less likely to be useful
now that we have a specific addrs.Provider type.
2020-02-06 11:28:48 -05:00
Nick Fagerlund 6494591ec1 website: Remove extra copy of "Getting Started", update links
This guide now lives at:

- https://learn.hashicorp.com/terraform#getting-started

...and terraform.io has been redirecting to there for quite a while. This commit
removes the extra copy so that the text of the two versions doesn't drift, and
updates existing links to point to the new location.
2020-02-05 14:58:30 -08:00
Nick Fagerlund a797152648 website: Remove extra copy of "Running Terraform in Automation", update links
This document now lives at:

- https://learn.hashicorp.com/terraform/development/running-terraform-in-automation

...and terraform.io has been redirecting to there for quite a while. This commit
removes the extra copy so that the text of the two versions doesn't drift, and
updates existing links to point to the new location.
2020-02-05 14:58:30 -08:00
James Bardin 529271e0be update merge docs to match behavior 2020-02-05 15:47:36 -05:00