Commit Graph

21120 Commits

Author SHA1 Message Date
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
Martin Atkins da61627b9c
Update CHANGELOG.md 2017-11-01 17:00:43 -07:00
Martin Atkins 6d6a80fd9d
Update CHANGELOG.md 2017-11-01 16:58:31 -07:00
Martin Atkins 9d77d35f53
Update CHANGELOG.md 2017-11-01 16:56:59 -07:00
Martin Atkins 3da5fefdc1 command: Allow TF_DATA_DIR env var to override data directory
This allows the user to customize the location where Terraform stores
the files normally placed in the ".terraform" subdirectory, if e.g. the
current working directory is not writable.
2017-11-01 16:55:23 -07:00
Martin Atkins 4787428cad
Merge #14887: Custom diff logic for providers 2017-11-01 15:56:54 -07:00
Chris Marchesi 0c0ae3ca7c helper/schema: CustomizeDiff allowed on writable resources only
This keeps CustomizeDiff from being defined on data sources, where it
would be useless. We just catch this in InternalValidate like the rest
of the CRUD functions that are not used in data sources.
2017-11-01 15:42:24 -07:00
Chris Marchesi 2c541e8c97 helper/schema: Add behaviour detail to various custom diff comments
Added some more detailed comments to CustomizeDiff's comments. The new
comments detail how CustomizeDiff will be called in the event of
different scenarios like creating a new resource, diffing an existing
one, diffing an existing resource that has a change that requires a new
resource, and destroy/tainted resources.

Also added similar detail to ForceNew in ResourceDiff.

This should help mitigate any confusion that may come up when using
CustomizeDiff, especially in the ForceNew scenario when the second run
happens with no state.
2017-11-01 15:42:24 -07:00
James Bardin 229c70cabe
Merge pull request #16296 from stack72/manta-backend
Migrate Manta Remote state to be a backend
2017-11-01 18:07:26 -04:00
Radek Simko b599dc6471
Make CoC and support channels more visible
https://help.github.com/articles/adding-a-code-of-conduct-to-your-project/
https://help.github.com/articles/adding-support-resources-to-your-project/
2017-11-01 23:06:23 +01:00
Chris Marchesi 5031767b93 terraform: Add more exception cases for value comparison
Needed to add more cases to support value comparison exceptions that the
rest of TF expects to work (this fixes tests in various places).

Also moved things to a switch block so that it's a little more compact.
2017-11-01 14:25:32 -07:00
Chris Marchesi 12378b4ee2 terraform: Add value check to diff.Same
A diff new needs to pass basic value checks to be considered the
"same". Several provisions have been added to ensure that the list, set,
and RequiresNew behaviours that have needed some exceptions in the past
are preserved in this new logic.

This ensures that we are checking for value equality as much as
possible, which will be more important when we transition to the
possibility of diffs being sourced from external data.
2017-11-01 14:25:32 -07:00
Chris Marchesi f5bdbc0911 helper/schema: Simplify setDiff, remove exported SetDiff mentions
setDiff does not make use of its new parameter anymore, so it has been
removed. Also, as there is no more SetDiff (exported) function, mentions
of that have been removed from comments too.
2017-11-01 14:25:32 -07:00
Chris Marchesi 3ac0cdf0c0 helper/schema: Better ResourceDiff schema key validation
This fixes nil pointer issues that could come up if an invalid key was
referenced (ie: not one in the schema). Also ships a helper validation
function to streamline things.
2017-11-01 14:25:32 -07:00
Chris Marchesi 5d5a670d69 provider/test: Added complex-ish list testing
Added a list SetNew test to try and reproduce issues testing diff
customization with the Nomad provider. We are running into "diffs didn't
match during apply", with the plan diff exhibiting a strange
off-by-one-type error in a list diff:

  datacenters.#:         "1" => "2"
  datacenters.0:         "dc1" => "dc2"
  datacenters.1:         "" => "dc3"
  datacenters.2:         "" => "dc3"

The test here does not reproduce that issue, unfortunately, but should
help pinpoint the root cause through elimination.
2017-11-01 14:25:32 -07:00
Chris Marchesi 529d7e6dae helper/schema: Review -> CustomizeDiff
Restoring the naming of this field in the resource back to
CustomizeDiff, as this is generally more descriptive of the process
that's happening, despite the lengthy name.
2017-11-01 14:25:32 -07:00
Chris Marchesi 09e2109ff8 helper/schema: Resouce.Diff no longer ResourceProvider API compatible
The old comments said that this interface was API compatible with
terraform.ResourceProvider's Diff method - with the addition of passing
down meta to it, this is no longer the case.

Not too sure if this is really a big deal - schema.Resource never fully
implemented terraform.ResourceProvider, from what I can see, and the
path from Provdier.Diff to Resource.Diff is still pretty clear. Just
wanted to remove an outdated comment.
2017-11-01 14:25:32 -07:00
Chris Marchesi 9625830980 helper/schema: Move computedKeys init to init function
This simplifies the new value initialization and future-proofs it
against more complex initialization functionality.
2017-11-01 14:25:32 -07:00
Chris Marchesi f0aafe4d67 helper/schema: Restore new value for complex set test 2017-11-01 14:25:32 -07:00
Chris Marchesi 3444549d60 helper/schema: Move computed key reader logic to childAddrOf
This will make this check safer and will remove the risk of it passing
on keys with a similar prefix.
2017-11-01 14:25:32 -07:00
Chris Marchesi 36aa63b338 helper/schema: Guard against out of range on childAddrOf
This could panic if we sent a parent that was actually longer than the
child (should almost never come up, but the guard will make it safe
anyway).

Also fixed a slice style lint warning in UpdatedKeys.
2017-11-01 14:25:32 -07:00