Commit Graph

20840 Commits

Author SHA1 Message Date
James Bardin 3297f60d03 remove raw print statements 2017-11-06 17:10:33 -05:00
James Bardin 6302916e65
Merge pull request #16572 from hashicorp/jbardin/provider-config
don't add missing provider aliases to the graph
2017-11-06 15:03:27 -05:00
James Bardin a089a4ba21
Merge pull request #16573 from hashicorp/jbardin/ProvidedBy
Minor cleanup, ProvidedBy return value is a single string
2017-11-06 15:03:12 -05:00
James Bardin 72d4e15c47 ProvidedBy return value is a single string
Clean up ProvidedBy, which doesn't need to be a slice.
2017-11-06 14:27:01 -05:00
James Bardin d9d21d4200 don't add missing provider aliases to the graph
A missing provider alias should not be implicitly added to the graph.

Run the AttachaProviderConfigTransformer immediately after adding the
providers, since the ProviderConfigTransformer should have just added
these nodes.
2017-11-06 14:21:28 -05:00
Malik Bougacha ed0d57d1b7 Get the enviroment from the environment variable (#16326)
* Get the enviroment from the enviroment variable

* typo
2017-11-06 16:59:48 +00:00
James Belchamber ec2281106f Adding documentation for all supported imports in the Heroku provider (#16312) 2017-11-06 16:57:57 +00:00
Dominik Lekse 323654a716 Fixed documentation of azurerm backend advanced access variables (#16552)
Signed-off-by: Dominik Lekse <dominik@lekse.de>
2017-11-06 16:54:30 +00:00
Chris Marchesi 1bed7deb8f
Merge pull request #16565 from hashicorp/b-mapwriter-overwrites
helper/schema: Clear existing map/set/list contents before overwriting
2017-11-06 08:33:11 -08:00
Andy Brody 4b1c7a1d9b website: Fix broken link in 0.10 upgrade guide 2017-11-05 18:21:49 -08:00
Chris Marchesi 3fa11e456b
helper/schema: Clear existing map/set/list contents before overwriting
There are situations where one may need to write to a set, list, or map
more than once per single TF operation (apply/refresh/etc). In these
cases, further writes using Set (example: d.Set("some_set", newSet))
currently create unstable results in the set writer (the name of the
writer layer that holds the data set by these calls) because old keys
are not being cleared out first.

This bug is most visible when using sets. Example: First write to set
writes elements that have been hashed at 10 and 20, and the second write
writes elements that have been hashed at 30 and 40. While the set length
has been correctly set at 2, since a set is basically a map (as is the
entire map writer) and map results are non-deterministic, reads to this
set will now deliver unstable results in a random but predictable
fashion as the map results are delivered to the caller non-deterministic
- sometimes you may correctly get 30 and 40, but sometimes you may get
10 and 20, or even 10 and 30, etc.

This problem propagates to state which is even more damaging as unstable
results are set to state where they become part of the permanent data
set going forward.

The problem also applies to lists and maps. This is probably more of an
issue with maps as a map can contain any key/value combination and hence
there is no predictable pattern where keys would be overwritten with
default or zero values. This is contrary to complex lists, which has
this problem as well, but since lists are deterministic and the length
of a list properly gets updated during the overwrite, the problem is
masked by the fact that a read will only read to the boundary of the
list, skipping any bad data that may still be available due past the
list boundary.

This update clears the child contents of any set, list, or map before
beginning a new write to address this issue. Tests are included for all
three data types.
2017-11-05 12:04:23 -08:00
Martin Atkins 645df36af0 release: clean up after v0.11.0-beta1 2017-11-03 23:51:47 +00:00
Martin Atkins 23caaf9feb
v0.11.0-beta1 2017-11-03 23:17:07 +00:00
Martin Atkins 37e276e043 core: test correct behavior of plan+apply with unstable values
We have a few pesky functions that don't act like proper functions and
instead return different values on each call. These are tricky because
we need to make sure we don't trip over ourselves by re-generating these
between plan and apply.

Here we add a context test to verify correct behavior in the presence
of such functions.

There's actually a pre-existing bug which this test caught as originally
written: we re-evaluate the interpolation expressions during apply,
causing these unstable functions to produce new values, and so the
applied value ends up not exactly matching the plan. This is a bug that
needs fixing, but it's been around at least since v0.7.6 (random old
version I tried this with to see) so we'll put it on the list and address
it separately. For now, this part of the test is commented out with a
TODO attached.
2017-11-03 16:11:13 -07:00
Martin Atkins c003e8f9a6 core: don't compare attribute values in Diff.Same
We previously didn't compare values but had a TODO to start doing so,
which we then recently did. Unfortunately it turns out that we _depend_
on not comparing values here, because when we use EvalCompareDiff (a key
user of Diff.Same) we pass in a diff made from a fresh re-interpolation
of the configuration and so any non-pure function results (timestamp,
uuid) have produced different values.
2017-11-03 16:11:13 -07:00
Martin Atkins 46d2b76e5f
Update CHANGELOG.md 2017-11-03 12:20:53 -07:00
Martin Atkins 46a8deb8d1
Update CHANGELOG.md 2017-11-03 12:19:24 -07:00
Martin Atkins 3b180d7f8a
Merge #16543: Bring the "terraform" provider back into core 2017-11-03 12:08:31 -07:00
Martin Atkins d4ee58ce59 Re-integrate the "terraform" provider into the main binary
As part of the 0.10 core/provider split we moved this provider, along with
all the others, out into its own repository.

In retrospect, the "terraform" provider doesn't really make sense to be
separated since it's just a thin wrapper around some core code anyway,
and so re-integrating it into core avoids the confusion that results when
Terraform Core and the terraform provider have inconsistent versions of
the backend code and dependencies.

There is no good reason to use a different version of the backend code
in the provider than in core, so this new "internal provider" mechanism
is stricter than the old one: it's not possible to use an external build
of this provider at all, and version constraints for it are rejected as
a result.

This provider is also run in-process rather than in a child process, since
again it's just a very thin wrapper around code that's already running
in Terraform core anyway, and so the process barrier between the two does
not create enough advantage to warrant the additional complexity.
2017-11-03 11:36:31 -07:00
James Bardin f25d08061d
Merge pull request #16542 from hashicorp/jbardin/module-ui
update init output
2017-11-03 14:11:36 -04:00
Masayuki Morita 3efb163edd Update CHANGELOG.md 2017-11-03 08:14:38 -07:00
James Bardin 964054efc0 update tests for updated output 2017-11-03 11:13:31 -04:00
James Bardin f3470de2f0
Merge pull request #16546 from hashicorp/jbardin/mmissing-provider-transformer
further simplify the missing provider transformer
2017-11-03 11:01:56 -04:00
James Bardin 2ed529f81a update from review
Reference modules by terraform address
Unquote versions
2017-11-03 10:50:19 -04:00
James Bardin c510473fd2 remove code added by stale vim buffer 2017-11-03 10:33:18 -04:00
James Bardin 1bf64ec788 add "Updating" output and fix output tests 2017-11-03 10:28:08 -04:00
James Bardin 9c334fe012 update init output
Change "Downloading" to 'Initializing" to match the provider loading
dialog.

List each module being loaded.

If a regisry module is being downloaded, list the registry host, and the
version discovered.

Show the source string from the config that is being fetched, rather
than the go-getter url. The full source can be found in the logs for
debugging.

Add much more extensive logging
2017-11-03 10:28:07 -04:00
Paul Stack 002200b8f1 websites/workspaces: Add Manta to the list of workspace backends (#16545)
As Manta backend has now been merged, this should have been done in the same PR - apologises for that
2017-11-03 15:26:19 +01:00
James Bardin 9b489c452e further simplify the missing provider transformer
We can remove the AllowAny option which is no longer used, and providers
don't need to be connected to their resources at this stage, since that
will happen in the ProviderTransformer.
2017-11-03 10:26:03 -04:00
Tom Harvey 84d18ad579
Updating to include #16296 2017-11-03 15:20:49 +01:00
Tom Harvey 25c3a879db
Adding `azurerm` to the list of supported backends (#16531)
Fixes #16530
2017-11-03 14:57:43 +01:00
James Bardin 89b931e18a
Merge pull request #16540 from hashicorp/jbardin/provider-inheritance
New provider inheritance
2017-11-02 17:41:41 -04:00
James Bardin ecdba2b0b2 add transform step logs from GraphTransformMulti 2017-11-02 16:38:32 -04:00
James Bardin b4e9240679 remove implicit provier tests from config/module
No longer needed
2017-11-02 15:43:45 -04:00
James Bardin 523b121341 fix get test working directory
use a temp dir and cleanup
2017-11-02 15:38:53 -04:00
James Bardin 241dae7ead resintate disabled tests
Reinstate the disabled tests that required some sort of inheritance
during graph evaluation.
2017-11-02 15:29:51 -04:00
James Bardin 05ef30be2c udpate test graph outputs
Some of the test graph outputs have changes now that implicit providers
are no longer added in the config.
2017-11-02 15:29:51 -04:00
James Bardin 838ffafc18 stop adding implicit provider configs
Now that providers in the graph can adopt resources without an explicit
provider, there's no need to add the implicit configs to the module.Tree
when loading.
2017-11-02 15:29:51 -04:00
James Bardin a782568645 simplify MissingProvider and ParentProvider transf
Simplify the MissingProviderTransformer so that it only adds missing
providers at the root level. There's no need for the multitple providers
added at every level of the path

ParentProviderTransformer then only needs to connect providers with the
equivalent type at the root level.
2017-11-02 15:29:51 -04:00
James Bardin 341ec39174 udpate more tests to remove intermediate providers
The new missing provider transformer doesn't add these nay longer
2017-11-02 15:29:51 -04:00
James Bardin 94ee4d9111 Add new test and update graph outputs
The the grandChild missing test has a provider declared in a child
module which is missing in a grandchildmodule. Verify that the
grandchild gets connected to the child provider, and they all are
connected to the root providers.

Update some test outputs to match the expected behavior of only adding
missing providers at the root level.
2017-11-02 15:00:06 -04:00
James Bardin 2f91007999 group the provider transformations
The series of provider transformations is important, and often repeated.
Group these together in a single transform function.
2017-11-02 15:00:06 -04:00
James Bardin 12a4a29cbd update missing provider transform test
The CloserProviderTransformer requires that the resources be connected
to their provider first, so that it cen get the correct dependencies,
and adding the ProviderTransformer changed the test output slightly.
2017-11-02 15:00:06 -04:00
James Bardin 8388dfd2f9 update GraphBuilder_targetModule test
The updates CLoseProviderTransformer connects all provider instances,
which is technically the correct behavior.
2017-11-02 15:00:06 -04:00
James Bardin a14fd0344c WIP reference providers by full name
This turned out to be a big messy commit, since the way providers are
referenced is tightly coupled throughout the code. That starts to unify
how providers are referenced, using the format output node Name method.

Add a new field to the internal resource data types called
ResolvedProvider. This is set by a new setter method SetProvider when a
resource is connected to a provider during graph creation. This allows
us to later lookup the provider instance a resource is connected to,
without requiring it to have the same module path.

The InitProvider context method now takes 2 arguments, one if the
provider type and the second is the full name of the provider. While the
provider type could still be parsed from the full name, this makes it
more explicit and, and changes to the name format won't effect this
code.
2017-11-02 15:00:06 -04:00
James Bardin 1d54d4b10d WIP start only referring to provier by adddress
Don't try to build a full adress based on the context path for providers
in EvalContextBuiltin. Only use the name explicitly provided.
2017-11-02 15:00:06 -04:00
James Bardin f0727501c1 WIP only add missing providers at the root level
When looking for providers to connect to resources, walk up the resource
path to find the appropriate provider.
2017-11-02 15:00:06 -04:00
James Bardin 0986d01223 add providers directly from the configuration
The first step in only using the required provider nodes in a graph is
to be able to specifically add them from the configuration.

The MissingProviderTransformer was previously responsible for adding
all providers. Now it is really just adding any that are missing from
the config.
2017-11-02 15:00:06 -04:00
Martin Atkins bcc5dffea2 provider/terraform: import terraform provider back into core 2017-11-02 10:48:20 -07:00
Martin Atkins a3ced1a367 provider/terraform: reorganize for merge into core
The "terraform" provider was previously split out into its own repository,
but that turned out to be a mistake due to how tightly it depends on
aspects of Terraform Core.

Here we prepare to bring it back into the core repository by reorganizing
the directory layout to conform with what's expected there.
2017-11-02 10:46:31 -07:00