Commit Graph

25727 Commits

Author SHA1 Message Date
James Bardin 73492fd2d5 add module expansion to validation
We cannot evaluate expansion during validation, since the values may not
be known at that time.

Inject a nodeValidateModule, using the "Concrete" pattern used for other
node types during graph building. This node will always evaluate to a
single module instance, so that we have a valid context within which to
evaluate all sub resources.
2020-04-05 12:13:48 -04:00
James Bardin 5fda76e31d simplify module expansion eval
Make the expansion logic easier to follow, keeping the evaluation and
registration local to switch cases. We don't validate anything between
count or for_each (config loading should handle that), and we don't need
to keep relying on the count == -1 sentinel value.
2020-04-05 11:07:38 -04:00
James Bardin cd65b28da0 don't call os.NewFile on unknown FDs
os.NewFile was called on file descriptors 3, 4, and 5 during every init,
in case this process happened to be running inside panicwrap. If the
runtime has already chosen one of these file descriptors to use
internally, starting polling on them can cause the runtime to crash.

Initialize the file descriptors lazily, only if we know that they belong
to us, after Wrapped is checked.
2020-04-04 15:46:19 -04:00
Petros Kolyvas ad15e4a116
A few more spacing issues in MD format for GH 2020-04-03 16:15:09 -04:00
Petros Kolyvas c7cae98076
GitHub hates me 2020-04-03 16:14:08 -04:00
Petros Kolyvas cd54300621 Why won't you h4 maintainers. 2020-04-03 16:13:36 -04:00
Petros Kolyvas db5878ff04 More updates and fixes, some grammatical, some clarity issues, one markdown bugaboo 2020-04-03 16:11:42 -04:00
Petros Kolyvas 68155c23ac Merge branch 'contribution-codeowners' of github:pkolyvas/terraform into contribution-codeowners 2020-04-03 16:06:11 -04:00
Petros Kolyvas ca90de14ec Updated Contribution Guide TOC 2020-04-03 16:04:55 -04:00
Petros Kolyvas 942b4df545 Added a provisioners section and a maintainers section 2020-04-03 16:00:19 -04:00
James Bardin 60e407a59b
Merge pull request #24539 from hashicorp/jbardin/expanded-orphans
handle orphaned instances in expanded modules
2020-04-03 13:16:29 -04:00
James Bardin 2c5e2d6b5b add missing action check in orphan test 2020-04-03 11:28:31 -04:00
James Bardin 512830bb7b update CHANGELOG.md 2020-04-03 10:07:47 -04:00
James Bardin 4e0b6d5467
Update terraform/node_module_expand.go
Co-Authored-By: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2020-04-03 09:30:25 -04:00
James Bardin 841b0f66c8 rename evalModuleRoot
use evalCloseModule to match the parent node name
2020-04-02 16:04:05 -04:00
James Bardin 69b74ba62b add new root node to test output 2020-04-02 16:00:36 -04:00
James Bardin 0dcca1bc37 make the root node a nodeCloseModule for root
Replace the graphNodeRoot for the main graph with a nodeCloseModule for
the root module. USe a new transformer as well, so as to not change any
behavior of DynamicExpand graphs.

Closing out the root module like we do with sub modules means we no
longer need the OrphanResourceTransformer, or the NodeDestroyResource.
The old resource destroy logic has mostly moved into the instance nodes,
and the remaining resource node was just for cleanup, which need to be
done again by the module since there isn't always a NodeDestroyResource
to be evaluated.

The more-correct state caused a few tests to fail, which need to be
cleaned up to match the state without empty resource husks.
2020-04-02 16:00:36 -04:00
James Bardin 0e8cf5783e fix new graph builder test output 2020-04-02 16:00:36 -04:00
James Bardin 1a1ace5930 prune unused values based on behavior
remove the hard-coded types from PruneUnusedValuesTransformer
2020-04-02 16:00:36 -04:00
James Bardin c0bca9d5e9 check for the correct types when pruning values
There is not one more non-dependent type to look for when pruning unused
values. This fixes the oversight, but still leaves the ugly concrete
type checking which we need to remove.
2020-04-02 16:00:36 -04:00
James Bardin 2df7127943 add nodeCloseModule
During plan, anything dependent on a module can connect to the module
expansion node, because all instance nodes are created during
DynamicExpand. During apply the instance nodes are created from the
diff, so we need a root module to terminate the logical module subgraph.

Besides providing an anchor for the completion of a module, the
nodeCloseModule can also be used to cleanup the orphan resource and
module placeholders in the state.
2020-04-02 16:00:36 -04:00
James Bardin 026a45a390 remove abstract resource node from destroy node
NodeDestroyResource does not require a provider, and to avoid this a
temporary GraphNodeNoProvider was used to differentiate it from other
resource nodes. We can now de-couple the destroy node from the abstract
resource which was adding the ProvidedBy method, and remove the
NoProvider method.
2020-04-02 16:00:35 -04:00
James Bardin 8add45b076 expansion resource and instance orphans
When a module instances is removed, we need to add both the instance and
resource deletion nodes from that module.
2020-04-02 16:00:35 -04:00
James Bardin 7a26fcfe84 Add orphaned module instance test 2020-04-02 16:00:27 -04:00
Alisdair McDiarmid 6caf0830c5
Update CHANGELOG.md 2020-04-02 09:36:10 -04:00
Alisdair McDiarmid 2c70fbb815
Merge pull request #24523 from hashicorp/alisdair/terraform-state-replace-provider
command: Add state replace-provider subcommand
2020-04-02 09:35:02 -04:00
Alisdair McDiarmid cadc133828 addrs: Fix diagnostic for invalid provider type
This previously rendered as `Invalid provider type ""`, as `name` was
empty if parsing failed. Using the source string is more helpful.
2020-04-02 08:15:52 -04:00
Alisdair McDiarmid 7165d6c429 command: Add state replace-provider subcommand
Terraform 0.13 will allow the installation of providers from various
sources. If a user updates their configuration to change the source of
an in-use provider (for example, if the provider namespace changes),
they will also need to update the state file accordingly.

This commit introduces a new `state replace-provider` subcommand which
supports this. All resources using the `from` provider will be updated
to use the `to` provider.
2020-04-02 08:15:52 -04:00
Petros Kolyvas a3dcda6ae5
tabs are hard 2020-04-01 15:32:47 -04:00
Petros Kolyvas 464a40b185 OCD spacing, formatting of Codeowners 2020-04-01 15:31:12 -04:00
Petros Kolyvas ed9a2ea118 OCD spacing, formatting of Codeowners 2020-04-01 15:30:17 -04:00
Petros Kolyvas 9d097195a3
Fixing some minor formatting issues
They don't seem to be present on `localhost`
2020-04-01 15:28:50 -04:00
Alisdair McDiarmid f3bed4039f
Merge pull request #24526 from hashicorp/alisdair/refactor-meta-process
command: Simplify Meta.process helper method
2020-04-01 15:26:53 -04:00
Petros Kolyvas 3725b4b3a0 Updated provisioners & added team-tf-core to http backend ownship, possibly in error. 2020-04-01 15:09:15 -04:00
Alisdair McDiarmid 67203dade8 command: Simplify Meta.process helper method
After some refactoring, this helper method had an unused argument (vars)
and an always-nil error return value. This commit cleans this up.
2020-04-01 15:01:08 -04:00
Alvin Huang d425f62009 name long bash test command 2020-03-31 17:38:35 -07:00
Alvin Huang 11650bd1b5 migrate travis to circle 2020-03-31 17:38:35 -07:00
Petros Kolyvas 700182dc7a Fixed etcdv3 maintainer and added provisioners 2020-03-31 16:13:50 -04:00
Chris Griggs 5020320af6
Merge pull request #24404 from hashicorp/cgriggs01-remove-listing
[Website] Remove provider listing
2020-03-31 11:17:48 -07:00
Pam Selle c7b6dbbe7e
Merge pull request #24485 from hashicorp/readme-certificaiton-links
Added links to Learn and certification exams to the README
2020-03-27 19:51:22 -04:00
Petros Kolyvas 61fe0a3402 Fixed an ordering/clarity issue with the TOC 2020-03-27 17:20:53 -04:00
Petros Kolyvas 96e1a1f800 more prescriptive Contributor's guide 2020-03-27 17:12:35 -04:00
Petros Kolyvas 236b108cd8 Added etcdv3 maintainer 2020-03-27 16:43:49 -04:00
lszpunar f2dbf80bad Added links to Learn and certification exams to the README 2020-03-27 11:25:06 -07:00
Pam Selle 4d7e47e01c
Merge pull request #24483 from hashicorp/ci/add-sample-circle-config
add sample circleci config
2020-03-27 13:36:41 -04:00
James Bardin 63ef50212e update CHANGELOG.md 2020-03-27 13:02:55 -04:00
Alvin Huang fd6c0d650e add sample circleci config 2020-03-27 12:48:57 -04:00
Martin Atkins 4061cbed38 internal/getproviders: A new shared model for provider requirements
We've been using the models from the "moduledeps" package to represent our
provider dependencies everywhere since the idea of provider dependencies
was introduced in Terraform 0.10, but that model is not convenient to use
for any use-case other than the "terraform providers" command that needs
individual-module-level detail.

To make things easier for new codepaths working with the new-style
provider installer, here we introduce a new model type
getproviders.Requirements which is based on the type the new installer was
already taking as its input. We have new methods in the states, configs,
and earlyconfig packages to produce values of this type, and a helper
to merge Requirements together so we can combine config-derived and
state-derived requirements together during installation.

The advantage of this new model over the moduledeps one is that all of
recursive module walking is done up front and we produce a simple, flat
structure that is more convenient for the main use-cases of selecting
providers for installation and then finding providers in the local cache
to use them for other operations.

This new model is _not_ suitable for implementing "terraform providers"
because it does not retain module-specific requirement details. Therefore
we will likely keep using moduledeps for "terraform providers" for now,
and then possibly at a later time consider specializing the moduledeps
logic for only what "terraform providers" needs, because it seems to be
the only use-case that needs to retain that level of detail.
2020-03-27 09:01:32 -07:00
Pam Selle 4b2c45be11
Update CHANGELOG.md 2020-03-27 11:43:54 -04:00
Pam Selle 41d2c4f172
Merge pull request #24321 from davidMcneil/master
Fix permissions of habitat provision's user.toml
2020-03-27 11:29:38 -04:00