Commit Graph

25727 Commits

Author SHA1 Message Date
James Bardin 27cc2aeb9c change evaluation to use whole modules
The evaluationStateData needs the change to the GetModule method to work
with the new evaluator. This is using a deep copy of module instances,
which we will clean up after some changes to the states package.
2020-04-13 16:23:24 -04:00
James Bardin 323d9fb69f plans fix 2020-04-13 16:21:09 -04:00
James Bardin 2490e6c84b provide a method to get all modules changes
Since modules need to be evaluated as whole objects, yet the outputs are
all handled individually, we need a method to collect and return all
output changes for a module from the plan, including all known
module instances.
2020-04-12 11:29:21 -04:00
James Bardin a7507e140d parse module references as whole modules
Module references, like resource references, need to always return the
and object containing all instances in order to handle modules as single
values, and to postpone index evaluation to when the expression as whole
is evaluated.
2020-04-12 11:26:44 -04:00
James Bardin 600d4c3e1f eval Data needs to operate on whole modules
In order to be able to use module values, and handle operations like
possibly invalid module indexes in conditional statements, whole modules
must always be returned during evaluation.
2020-04-12 10:50:31 -04:00
James Bardin aeadb8ca90 start with a failing test 2020-04-10 16:52:47 -04:00
Stanislav Petrashov 0add5d4915 Update community-index.html.markdown 2020-04-09 15:59:36 -07:00
Michael Conlon 1ec6fc6643
website: note special behavior for modules in us-east-1 S3 buckets (#24155)
* Keep s3 docs in line with functionality

Related to https://github.com/hashicorp/terraform/issues/16442

* @nfagerlund's suggested markdown and wording changes
2020-04-09 15:56:59 -07:00
Petros Kolyvas 2bb020193b
Merge pull request #24556 from pkolyvas/contribution-codeowners
An update to our CODEOWNERS and Contribution Guide
2020-04-09 14:12:09 -04:00
Chris Griggs c71716e6d2
Merge pull request #24618 from hashicorp/cgriggs01-sumologic-link
[Website] Add SumoLogic provider links
2020-04-09 10:11:07 -07:00
Chris Griggs 7c5b0e509a [Website] Add SumoLogic provider links 2020-04-09 09:39:29 -07:00
James Bardin 9c75cfd403
Merge pull request #24605 from hashicorp/jbardin/validate-module-variable
Allow module variables to pass validation
2020-04-09 11:54:50 -04:00
James Bardin 3d8b1dea97
Update terraform/eval_for_each.go
Co-Authored-By: Pam Selle <pam@hashicorp.com>
2020-04-09 11:47:16 -04:00
James Bardin 73a20bfb17 fixup mangled comments 2020-04-09 10:13:03 -04:00
James Bardin b1bc7a792b rename and cleanup use of count/for_each eval func
Stop evaluating count and for each if they aren't set in the config.
Remove "Resource" from the function names, as they are also now used
with modules.
2020-04-08 17:21:23 -04:00
James Bardin 4f7d30900e
Merge pull request #24599 from hashicorp/jbardin/races
Fix races in GetVariableValue and login
2020-04-08 17:13:21 -04:00
James Bardin d060a3d0e8 eval variables with unknown expansion data
While we don't have any expansion info during validation, we can try to
evaluate variable expressions to catch some basic errors. Do this by
creating module instance RepetitionData with unknown values. This
unfortunately will still miss the incorrect usage of count/each values,
but that would require the module call's each mode, which is not
available at this time.
2020-04-08 15:37:38 -04:00
James Bardin c59ecac870 rename module variables and remove extra methods
The variable nodes are not only used during plan and apply, so remove
those from there names. The "plan" node is now
`nodeExpandModuleVariable` and the "apply" node is now just
`nodeModuleVariable`.

Remove unnecessary methods, as the nodeModuleVariable is no longer used
in the full graph transformations.
2020-04-08 14:41:52 -04:00
James Bardin f0abc7e2e6
Merge pull request #24574 from hashicorp/jbardin/module-references
Point module references to the close node
2020-04-08 12:41:05 -04:00
James Bardin 43d93b2036 remove excess logging from dag
The dag Update messages were not particularly helpful in the debugging
of terraform, and since we're going to be relying on DynamicExpand to an
even greater extent, this will eliminate a log of extra log output.
2020-04-08 12:30:35 -04:00
James Bardin 700e20de5d connect references to the module closer
NodeModuleRemoved is redundant now with the concept of
nodeCloseModule, so we can replace it within the graph. This does mean
that nodeCloseModule needs to know if it's evaluating an orphaned module
that can't be expanded, but the overhead to checking this isn't too
bad.

Now that nodeModuleClose is referenceable, and we can ensure it's always
in the graph at the correct time, we can eliminate the need to connect
each resource to every single node within a module it references, and
instead connect only to the nodeModuleClose, which acts as the module
root. Since module expansion can cause exponential growth in the number
of edges in graphs, this will help with performance problems when
transforming and reducing these graphs by eliminating the bulk of
redundant edges. This will also help with general debugging, making the
graphs easier to read.
2020-04-08 12:30:35 -04:00
James Bardin 3ee9cf49ce missing wg.Wait in concurrent test 2020-04-08 10:55:20 -04:00
James Bardin b84e6f7f95 remove race from closed-over err variable 2020-04-08 10:12:46 -04:00
James Bardin 85593b432e add locks to testHook 2020-04-08 10:02:43 -04:00
James Bardin 695a5fe27d lock was missing in the call to GetVariableValue 2020-04-08 09:59:27 -04:00
Sathija Pavuluri a0832b9886
website: In import usage doc, use aws_network_acl as an example of complex import with secondary resources (#24525)
A proposed pull request to the AWS provider would change the import behavior of 
`aws_security_group`. This preemptive change will help keep the docs accurate if 
that gets merged.
2020-04-07 17:36:02 -07:00
James Bardin 2eba39a671
Merge pull request #24587 from hashicorp/jbardin/disallow-count-and-foreach
don't allow count && for_each in module calls
2020-04-07 17:30:04 -04:00
Martin Atkins 82ad9fd635
Update CHANGELOG.md 2020-04-07 11:25:05 -07:00
James Bardin 939d045a0b don't allow count && for_each 2020-04-07 14:18:08 -04:00
Martin Atkins 6ec5e0fc88 internal/getproviders: Tests for MemoizeSource
Due to other pressures at the time this was implemented, it was tested
only indirectly through integration tests in other packages. This now
introduces tests for the two main entry points on MemoizeSource.
2020-04-07 08:55:52 -07:00
Martin Atkins c6535a0fa4 internal/getproviders: Tests for MultiSource
Due to other pressures at the time this was implemented, it was tested
only indirectly through integration tests in other packages.

This now introduces tests for the two main entry points on the
MultiSource, along with its provider-address pattern matching logic.

This does not yet include thorough tests for
ParseMultiSourceMatchingPatterns, because that function still needs some
adjustments to do the same case folding as for normal provider address
parsing, which will follow in a latter commit along with suitable tests.

With that said, the tests added here do _indirectly_ test the happy path
of ParseMultiSourceMatchingPatterns, so we have some incomplete testing
of that function in the meantime.
2020-04-07 08:55:13 -07:00
Chris Griggs f8cbb1f5a2
Merge pull request #24578 from hashicorp/cgriggs01-community
[Website] New community providers
2020-04-07 08:48:44 -07:00
Pam Selle d109f79678
Merge pull request #24575 from hashicorp/pselle/mod-expansion-keywords
Enable count.index and each.key/value in module expansion
2020-04-07 10:03:13 -04:00
Pam Selle 66a9c51f74 Update comment to reflect new code 2020-04-07 06:20:30 -04:00
Chris Griggs e055ac80ae [Website] New community providers 2020-04-06 18:34:28 -07:00
Martin Atkins 0ad4c1be2f internal/getproviders: Tidy up some confusion about package hashes
Earlier on in the stubbing of this package we realized that it wasn't
going to be possible to populate the authentication-related bits for all
packages because the relevant metadata just isn't available for packages
that are already local.

However, we just moved ahead with that awkward design at the time because
we needed to get other work done, and so we've been mostly producing
PackageMeta values with all-zeros hashes and just ignoring them entirely
as a temporary workaround.

This is a first step towards what is hopefully a more intuitive model:
authentication is an optional thing in a PackageMeta that is currently
populated only for packages coming from a registry.

So far this still just models checking a SHA256 hash, which is not a
sufficient set of checks for a real release but hopefully the "real"
implementation is a natural iteration of this starting point, and if not
then at least this interim step is a bit more honest about the fact that
Authentication will not be populated on every PackageMeta.
2020-04-06 16:31:23 -07:00
Pam Selle 6962562a78 Update diagnostic messages 2020-04-06 17:15:46 -04:00
Pam Selle 57c26fc11b Evaluate ModuleCallArguments using the appropriate ModuleInstance scope 2020-04-06 17:15:46 -04:00
Petros Kolyvas 9d1d8c0212 Merge branch 'contribution-codeowners' of github:pkolyvas/terraform into contribution-codeowners 2020-04-06 16:44:43 -04:00
Petros Kolyvas 02d67b8049 Merge branch 'contribution-codeowners' of github:pkolyvas/terraform into contribution-codeowners 2020-04-06 16:44:33 -04:00
Petros Kolyvas e760927408
Update .github/CONTRIBUTING.md
Co-Authored-By: Pam Selle <pamela.selle@gmail.com>
2020-04-06 16:43:46 -04:00
Petros Kolyvas e92b8a82f4 Pam & Kristin's feedback & some more suggested changed. 2020-04-06 16:43:11 -04:00
Petros Kolyvas 783c06b6da
Kristin's corrections
Co-Authored-By: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2020-04-06 13:25:17 -04:00
James Bardin b1532c0f04 make the module closer referenceable
This is all that is required to make module reference ordering work
during apply, by adding and edge to the nodeCloseModule node, which will
be the last node evaluated in the module.
2020-04-06 13:04:24 -04:00
Petros Kolyvas 6529a7c6e9 Kristin's comments & suggested changes 2020-04-06 12:59:38 -04:00
Martin Atkins bc3de6e2d6 Merge of cross-cutting work for new provider naming
This merge introduces various work across the whole codebase to prepare
codepaths to deal with the new decentralized provider naming scheme and
to use the new provider installation codepaths that are aware of the
new scheme.

The incoming branch of commits here (the second commit in the merge)
contains a period where the tests were not passing as a tradeoff to keep
the individual changes separated while accepting that that makes that
part of the history unsuitable for "git bisect" usage. If you are using
git bisect on this portion of the history, exclude the commits from
the incoming branch.
2020-04-06 09:55:29 -07:00
Martin Atkins e404074bf6 terraform: Update a few tests for new provider FQNs
These will now use "default" provider addresses, rather than "legacy"
ones, so that they can cooperate with the rest of Terraform that has been
updated to no longer use legacy provider addresses.
2020-04-06 09:50:37 -07:00
Martin Atkins 3e3d8f6764 configs: Hint for a misplaced top-level required_providers block
With provider dependencies now appearing inside a nested block, it seems
likely that configuration examples showing dependencies out of context
will sometimes mislead users into thinking that required_providers is
toplevel.

To give better feedback in that situation, we'll produce a specialized
error in that case hinting the correct structure to the user.
2020-04-06 09:24:23 -07:00
Martin Atkins 297a3a5db9 command/init: Restore the unconstrained provider warnings
When a provider dependency is implicit rather than explicit, or otherwise
when version constraints are lacking, we produce a warning recommending
the addition of explicit version constraints in the configuration.

This restores the warning functionality from previous Terraform versions,
adapting it slightly to account for the new provider FQN syntax and to
recommend using a required_providers block rather than version constraints
in "provider" blocks, because the latter is no longer recommended in the
documentation.
2020-04-06 09:24:23 -07:00
Martin Atkins a6f63c4891 command/e2etest: update "init" tests for abbreviated provider addresses
We're now longer showing the default registry hostname as part of
addresses coming from that registry.
2020-04-06 09:24:23 -07:00