Commit Graph

24901 Commits

Author SHA1 Message Date
James Bardin
f766bb8380 prune unused resources from apply
If a resource is only destroying instances, there is no reason to
prepare the state and we can remove the Resource (prepare state) nodes.
They normally have pose no issue, but if the instances are being
destroyed along with their dependencies, the resource node may fail to
evaluate due to the missing dependencies (since destroy happens in the
reverse order).

These failures were previously blocked by there being a cycle when the
destroy nodes were directly attached to the resource nodes.
2019-10-24 12:04:46 -04:00
James Bardin
7108560228 failing test with destroy cycle
after the previous commit the cycle is broken, but we can't evaluate
resource counts that depends on data sources being destroyed.
2019-10-24 12:04:46 -04:00
James Bardin
eb6e7bba2e do not connect destroy and resource nodes
Destroy nodes do not need to be connected to the resource (prepare
state) node when adding them to the graph. Destroy nodes already have a
complete state in the graph (which is being destroyed), any references
will be added in the ReferenceTransformer, and the proper
connection to the create node will be added in the
DestroyEdgeTransformer.

Under normal circumstances this makes no difference, as create and
destroy nodes always have an dependency, so having the prepare state
handled before both only linearizes the operation slightly in the
normal destroy-then-create scenario.

However if there is a dependency on a resource being replaced in another
module, there will be a dependency between the destroy nodes in each
module (to complete the destroy ordering), while the resource node will
depend on the variable->output->resource chain. If both the destroy and
create nodes depend on the resource node, there will be a cycle.
2019-10-24 12:04:46 -04:00
James Bardin
3eb0e74ef9 failing test for module instance replace cycle
Destroy-time references are not correctly or fully inverted when
crossing module boundaries, causing cycle during apply.
2019-10-24 12:04:46 -04:00
James Bardin
470362b051 fix CBD tests to work on real data
The CBDEdgeTransformer tests worked on fake data structures, with a
synthetic graph, and configs that didn't match. Update them to generate
a more complete graph, with real node implementations, from real
configs.

The output graph is filtered down to instances, and the results still
functionally match the original expected test results, with some minor
additions due to using the real implementation.
2019-10-24 12:01:50 -04:00
James Bardin
8f35984791 Use Descendants rather than UpEdges in CBD
When looking for dependencies to fix when handling
create_before_destroy, we need to look past more than one edge, as
dependencies may appear transitively through outputs and variables. Use
Descendants rather than UpEdges.

We have the full graph to use for the CBD transformation, so there's no
longer any need to create a temporary graph, which may differ from the
original.
2019-10-24 12:01:50 -04:00
James Bardin
7c703b1bbf apply edge transforamtions after references
We can't correctly resolve the destroy ordering if all references
haven't been assigned to each node.
2019-10-24 12:01:50 -04:00
Pam Selle
cca36025d6
Merge pull request #22946 from hashicorp/kmoe/copy_dir_dotfiles
remove dotfile exclusion in copyDir
2019-10-24 12:01:42 -04:00
Pam Selle
9ee19eac94
Merge pull request #23177 from hashicorp/pselle/docs-syntax-link
Fix link in syntax docs
2019-10-24 11:59:08 -04:00
Pam Selle
0d4ea7d9ad Fix link in syntax docs 2019-10-24 11:57:08 -04:00
Kris Luminar
8bb0491dc1 website: clarify where you run the terraform init command 2019-10-24 08:41:00 -07:00
charlottemach
e3d38046dc website/docs: replace outdated tag syntax (#23111)
Fixes #21614
2019-10-24 11:23:17 -04:00
Pam Selle
90ecd17bd5 Fix err test 2019-10-23 14:04:39 -04:00
Pam Selle
8f04ab3eaf
Merge pull request #23157 from pselle/each-err
Add a special error when each.value is nil in for_each resources
2019-10-23 11:19:39 -04:00
Pam Selle
86d69bbe18 Tweak the message mildly 2019-10-23 11:18:10 -04:00
Pam Selle
13ff341447 Add a special error for each.value 2019-10-22 15:44:28 -04:00
Chris Griggs
d7bce857cf
Merge pull request #23125 from hashicorp/cgriggs01-launchdarkly
[Website] LaunchDarkly provider links
2019-10-21 11:48:56 -07:00
Chris Griggs
d7df6ce642
Merge pull request #23123 from hashicorp/cgriggs01-community
[Website] Update community providers
2019-10-21 11:48:02 -07:00
Martin Atkins
baa49f43c8
go.mod: We only expect Go 1.12
This was erroneously updated by some earlier operation, but
Terraform Core is still targeting only Go 1.12 for the moment.
2019-10-18 16:37:34 -07:00
cgriggs01
5452844c58 [Website] LaunchDarkly provider links 2019-10-18 14:07:36 -07:00
tf-release-bot
bac0577c70 Cleanup after v0.12.12 release 2019-10-18 18:50:39 +00:00
tf-release-bot
ade49ebca7
v0.12.12 2019-10-18 18:39:16 +00:00
Martin Atkins
4e787a2ade
Update CHANGELOG.md 2019-10-18 11:33:19 -07:00
Martin Atkins
b10f058cbb backend/remote: Only load variables if we're going to use them
Some commands don't use variables at all or use them in a way that doesn't
require them to all be fully valid and consistent. For those, we don't
want to fetch variable values from the remote system and try to validate
them because that's wasteful and likely to cause unnecessary error
messages.

Furthermore, the variables endpoint in Terraform Cloud and Enterprise only
works for personal access tokens, so it's important that we don't assume
we can _always_ use it. If we do, then we'll see problems when commands
are run inside Terraform Cloud and Enterprise remote execution contexts,
where the variables map always comes back as empty.
2019-10-18 11:31:19 -07:00
Martin Atkins
a8d01e3940 backend/remote: Report invalid variables only remotely
The remote backend uses backend.ParseVariableValues locally only to decide
if the user seems to be trying to use -var or -var-file options locally,
since those are not supported for the remote backend.

Other than detecting those, we don't actually have any need to use the
results of backend.ParseVariableValues, and so it's better for us to
ignore any errors it produces itself and prefer to just send a
potentially-invalid request to the remote system and let the remote system
be responsible for validating it.

This then avoids issues caused by the fact that when remote operations are
in use the local system does not have all of the required context: it
can't see which environment variables will be set in the remote execution
context nor which variables the remote system will set using its own
generated -var-file based on the workspace stored variables.
2019-10-18 11:31:19 -07:00
cgriggs01
8b3c0dd66b [Website] Update community providers 2019-10-18 11:26:05 -07:00
Martin Atkins
71e4468e09 contrib: Remove api-coverage tool
This tool is intended for analysis on Terraform's AWS provider, but that
provider is no longer developed in this repository and so this tool is
no longer functional.
2019-10-18 11:22:30 -07:00
Radek Simko
ec90bed62d
Merge pull request #22643 from hashicorp/version-tools
Version tools per Go convention under tools.go
2019-10-18 19:01:23 +02:00
Pam Selle
91b5343d2f
Merge pull request #22626 from mixmatch/patch-1
Update output
2019-10-18 10:21:57 -04:00
tf-release-bot
3085da3dd5 Cleanup after v0.12.11 release 2019-10-17 20:41:46 +00:00
tf-release-bot
690f1c51cb
v0.12.11 2019-10-17 20:30:11 +00:00
Radek Simko
7860f55e4f
Version tools per Go convention under tools.go 2019-10-17 22:23:39 +02:00
James Bardin
e32be4ef3e update CHANGELOG.md 2019-10-17 16:19:11 -04:00
Pam Selle
64f7f2c052
Update CHANGELOG.md 2019-10-17 13:45:43 -04:00
Pam Selle
3f359032ae
Update CHANGELOG.md
.terraformignore notes
2019-10-17 13:44:23 -04:00
Pam Selle
d08daa2001
Merge pull request #23105 from hashicorp/f-tfignore
.terraformignore support
2019-10-17 11:49:18 -04:00
Kristin Laemmert
47aa543731
Update CHANGELOG.md 2019-10-17 11:47:52 -04:00
Alex Harvey
cbeedfca35 provisioner/puppet: fix bug when connection type was not set in config (#23057)
Before this, the Terraform Puppet provisioner would error out in a
confusing way if the type attribute in a connection block was not given.

Apparently an omitted type leads to type having a value "" which must be
then assumed to mean "ssh".

Fixes #23004
2019-10-17 11:46:55 -04:00
Kristin Laemmert
ee854261c5
Update CHANGELOG.md 2019-10-17 11:35:47 -04:00
Kristin Laemmert
4b10a6e1bf
command/jsonplan: fix bug with nested modules output (#23092)
`marshalPlannedValues` builds a map of modules to their children in
order to output the resource changes in a tree. The map was built from
the list of resource changes. However if a module had no resources
itself, and only called another module (a very normal case), that module
would not get added to the map causing none of its children to be
output in `planned_values`.

This PR adds a walk up through a given module's ancestors to ensure that
each module, even those without resources, would be added.
2019-10-17 11:33:04 -04:00
Pam Selle
a8dcd0cab2 go mod vendor; go mod tidy 2019-10-17 11:14:30 -04:00
Pam Selle
210b3aff0a Upgrade go-slug 2019-10-17 11:12:00 -04:00
Pam Selle
2a292340d9 Add website docs 2019-10-17 11:12:00 -04:00
Pam Selle
a5f2f4cbba Update messaging for .terraformignore 2019-10-17 11:12:00 -04:00
Pam Selle
57cf6d74ce Point to tfignore branch of go-tfe 2019-10-17 11:12:00 -04:00
Radek Simko
c1ea09141f
Merge pull request #23063 from hashicorp/svchost-migration
Replace svchost package with hashicorp/terraform-svchost
2019-10-17 16:43:43 +02:00
Chris Griggs
a7af2a4034
Merge pull request #23082 from hashicorp/cgriggs01-okta-links
[Website] Provider links
2019-10-16 08:30:11 -07:00
cgriggs01
83e97fdbb5 Okta links + move venafi 2019-10-15 12:54:06 -07:00
Martin Atkins
f96edbb113 Revise our contributing/development documentation
Our documentation for how to contribute was in quite a state of disrepair,
with some documents still describing things as they were before moving
providers into separate repositories, others making assumptions about
Go development that are no longer true in modules mode, and so forth.

This is an attempt at a reset to a good state that should work with the
codebase as it currently stands, and should hopefully serve as a basis
for iterative improvement from here.

These new instructions lean primarily on standard Go toolchain usage and
instruct using the Makefile only for some Terraform-specific situations
that the Go toolchain does not automatically handle. The idea here is that
this direct usage of primary commands in the Go toolchain is less likely
to be broken by changes in future Go releases, and should be immediately
familiar to anyone who has experience with Go development.
2019-10-15 08:39:36 -07:00
Kristin Laemmert
96af863065
command/validate: warn if unused flags are set on the command line (#22989)
* command/validate: output a warning if unused flags are set

The -var and -var-file command line flags are accepted, but not used,
in `terraform validate`. This PR adds a warning for users who set either
of those flags, so they know that setting them has no effect.
2019-10-14 15:35:33 -04:00