Commit Graph

25 Commits

Author SHA1 Message Date
Martin Atkins
4ab8973520 core: provide config to all import context tests
We're going to use config to determine provider dependencies, so we need
to always provide a config when instantiating a context or we'll end up
loading no providers at all.

We previously had a test for running "terraform import -config=''" to
disable the config entirely, but this test is now removed because it makes
no sense. The actual functionality its testing still remains for now,
but it will be removed in a subsequent commit when we start requiring that
a resource to be imported must already exist in configuration.
2017-06-09 14:03:59 -07:00
Martin Atkins
c835ef8ff3 Update tests for the new ProviderResolver interface
Rather than providing an already-resolved map of plugins to core, we now
provide a "provider resolver" which knows how to resolve a set of provider
dependencies, to be determined later, and produce that map.

This requires the context to be instantiated in a different way, so this
very noisy diff is a mostly-mechanical update of all of the existing
places where contexts get created for testing, using some adapted versions
of the pre-existing utilities for passing in mock providers.
2017-06-09 14:03:59 -07:00
Mitchell Hashimoto
b2fb3b1d0f
terraform: import graph should setup parent refs to providers
Fixes #11212

The import graph builder was missing the transform to setup links to
parent providers, so provider inheritance didn't work properly. This
adds that.

This also removes the `PruneProviderTransform` since that has no value
in this graph since we'll never add an unused provider.
2017-01-24 15:36:45 -08:00
Mitchell Hashimoto
28d933f6dd
nitpicks for #10310 2016-11-23 09:40:11 -08:00
Daniel Spangenberg
804a5bd3c5 Implements import with specified provider
This allows the import with a specified provider.
So far it was not possible to get resources imported from a different provider
than the default.
2016-11-23 11:58:58 +01:00
Mitchell Hashimoto
ec0ef95c6f
terraform: verify import providers only depend on vars 2016-11-09 15:09:13 -08:00
Mitchell Hashimoto
2b72882405
terraform: import loads the context module by default
This allows it to load provider configuration and interpolate it rather
than it coming purely from the environment.
2016-11-09 15:08:22 -08:00
Mitchell Hashimoto
c22ab252dd
terraform: import specific index works [GH-7691] 2016-08-19 19:14:33 -04:00
Mitchell Hashimoto
27452f0043
terraform: Module option to Import to add module to graph 2016-05-11 13:02:37 -07:00
Mitchell Hashimoto
0d1debc0ae
terraform: import verifies the refresh results in non-nil state
/cc @jen20
2016-05-11 13:02:36 -07:00
Mitchell Hashimoto
33bbf09ff6
terraform: error if import with collision 2016-05-11 13:02:33 -07:00
Mitchell Hashimoto
c814d36333
terraform: handle multiple same named states 2016-05-11 13:02:33 -07:00
Mitchell Hashimoto
cfa58a25a6
terraform: test multiple return values 2016-05-11 13:02:33 -07:00
Mitchell Hashimoto
2ed23778b4
terraform: test importing into a new module with other modules 2016-05-11 13:02:33 -07:00
Mitchell Hashimoto
2738fa7df5
terraform: test importing into an existing module 2016-05-11 13:02:33 -07:00
Mitchell Hashimoto
7fe8b21969
terraform: verify import with missing type doesn't add to state 2016-05-11 13:02:32 -07:00
Mitchell Hashimoto
58fe557a9f
terraform: test that missing type results in error on import 2016-05-11 13:02:32 -07:00
Mitchell Hashimoto
0701c70eae
terraform: test import with module depth of two 2016-05-11 13:02:32 -07:00
Mitchell Hashimoto
0a7f48ab8e
terraform: import module works! 2016-05-11 13:02:32 -07:00
Mitchell Hashimoto
6f607d0c59
terraform: MissingProviderTransformer now injects missing modules 2016-05-11 13:02:32 -07:00
Mitchell Hashimoto
1d3f11f0ba
terraform: working on fixes for imports in modules 2016-05-11 13:02:32 -07:00
Mitchell Hashimoto
0ab0ccf5b3
terraform: verify refresh is called on import 2016-05-11 13:02:31 -07:00
Mitchell Hashimoto
59e498dba8
terraform: basic test passing 2016-05-11 13:02:31 -07:00
Mitchell Hashimoto
aca26fd784
terraform: ImportTransformer, EvalImportState 2016-05-11 13:02:31 -07:00
Mitchell Hashimoto
9142ec400e
terraform: flowerbox the ResourceProvider interface because it is huge 2016-05-11 13:02:30 -07:00