Commit Graph

28619 Commits

Author SHA1 Message Date
Daniel Dreier c14d6f4241
Fix typo in CONTRIBUTING.md 2020-04-13 18:01:12 -07:00
Pam Selle ab101f99df
Merge pull request #24635 from hashicorp/pselle/docs-mod-count
Docs for count/for_each on modules
2020-04-13 18:39:59 -04:00
James Bardin 2c4c027a97 Add ModuleOutputs method to states
In order to efficiently build the module objects for evaluation, we need
to collect the outputs from a set of module instances. The ModuleOutputs
method will return a copy of the state outputs, while not requiring the
unnecessary copying of each entire module.
2020-04-13 17:59:09 -04:00
James Bardin e9eb8e04cc add AbsOutputAddrs to state outputs
We need all module instance outputs to build the objects for evaluation,
but there is no need to copy all the resource instances along with that.
This allows us to only return the output states, with enough information
to connect them with their module instances.
2020-04-13 16:37:59 -04:00
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
Ryan Uber 93906e1ad8 backend/remote: display cost estimate and policy check whenever available 2020-04-13 13:04:53 -07:00
Chris Griggs 8da255073e [Website] provider links 2020-04-13 12:29:15 -07:00
Pam Selle 146644a848 update addressing section 2020-04-13 12:13:18 -04:00
Pam Selle 608c17d518 Update providers block notes 2020-04-13 12:08:08 -04:00
Fred 76f583ac9f
website/docs: fix broken hcl json spec link (#24630) 2020-04-13 11:15:13 -04:00
Alisdair McDiarmid 9128ce611a vendor: go get github.com/hashicorp/hcl/v2@v2.4.0 2020-04-13 10:48:29 -04:00
Alisdair McDiarmid 65f9de04af
Update CHANGELOG.md 2020-04-13 09:44:47 -04:00
Alisdair McDiarmid 4cc18ce061
Merge pull request #24621 from hashicorp/alisdair/upgrade-go-cty
vendor: go get github.com/zclconf/go-cty@v1.4.0
2020-04-13 09:42:42 -04:00
Mikhail Mazurskiy c9ce1f0c1f
Fix typos (#24531) 2020-04-13 08:34:40 -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
Pam Selle 65c4ba9c85 First docs for count/for_each on modules 2020-04-10 15:14:06 -04:00
Kristin Laemmert 4079247270
Update CHANGELOG.md 2020-04-10 15:11:46 -04:00
Kristin Laemmert 269d511481 command/providers: refactor with new provider types and functions
The providers command has been refactored to use the modern provider types and
ProviderRequirements() functions. This resulted in a breaking change to
the output: it no longer outputs the providers by module and no longer
prints `(inherited)` or `(from state)` to show why a provider is
included. We decided that at this time it was best to stick with the
existing functions and make this change, but if we get feedback from the
community we will revisit.

Additional tests to exercise providers in modules and providers from
state have been included.
2020-04-10 15:08:10 -04:00
Kristin Laemmert 0a5fb40fdf configs: include provider configs in ProviderRequirements()
This PR adds iteration through any provider configuration blocks in the
config in addProviderRequirements().

A stale comment (of mine!) would leave one expecting the
module.ProviderRequirements to include any requirements from provider
configs. The comment was inaccurate and has been updated.
2020-04-10 15:08:10 -04:00
James Bardin 5ddb1a5808
Merge pull request #24623 from hashicorp/jbardin/module-output-references
Correctly connect module output references during plan
2020-04-10 14:46:25 -04:00
James Bardin 46b85820ba
Update addrs/module_call.go
Co-Authored-By: Pam Selle <pam@hashicorp.com>
2020-04-10 14:45:36 -04:00
Eduard Tamsa 534ba630e4
docs(flatten): Fix typos (#24492) 2020-04-10 08:59:17 -04:00
Kyler Middleton 89bef596fc
docs: Fix typo in maintainer-etiquette (#24609) 2020-04-10 08:55:19 -04:00
Danny Guo b7b981fbe1
website/docs: Fix a typo in the import command docs (#24622) 2020-04-10 08:54:19 -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
James Bardin b9ddec33e9 de-specify module output references
Like resource references, we need to make instance references less
specific when they aren't expanded yet during plan.
2020-04-09 15:41:35 -04:00
James Bardin a805e14283 module output expansion test 2020-04-09 15:39:48 -04:00
James Bardin a0f92f9d6a remove extra brackets in state string output 2020-04-09 15:36:16 -04:00
Alisdair McDiarmid 1593b8b8e5 vendor: go get github.com/zclconf/go-cty@v1.4.0
This fixes several bugs:

- `substr("abc", 0, 0)` would previously return `"abc"`, despite the
  length argument being `0`. This has been changed to return an empty
  string when length is zero.

- `ceil(1/0)` and `floor(1/0)` would previously return a large integer
  value, rather than infinity. This has been fixed.
2020-04-09 14:19:05 -04: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