Commit Graph

24877 Commits

Author SHA1 Message Date
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
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
Radek Simko 9051591899
go mod tidy & go mod vendor 2019-10-11 22:41:27 +01:00
Radek Simko cd21a3859d
Remove svchost package 2019-10-11 22:40:57 +01:00
Radek Simko 32f9722d9d
Replace import paths & set UA string where necessary 2019-10-11 22:40:54 +01:00
Martin Atkins 047733d20c website: Full examples for for_each with flatten and setproduct
A very common question since we launched the two repetition constructs
is how to deal with situations where the input data structure doesn't
match one-to-one with the desired configuration.

This adds some full worked examples of two common situations that have
come up in questions. To avoid adding a lot of extra content to the
already-large "expressions" and "resources" pages, the main bulk of this
new content lives with the relevant functions themselves as a full example
of one thing they are good for, and then we'll link to them from the two
general documentation sections where folks are likely to be reading when
they encounter the problem.
2019-10-11 13:41:58 -07:00
Kristin Laemmert 0d27e8ca7d
Update CHANGELOG.md 2019-10-11 13:02:16 -04:00
Stas Alekseev 6656104f8f deps: github.com/hashicorp/aws-sdk-go-base@v0.4.0 (#22994) 2019-10-11 12:50:12 -04:00
Martin Atkins cf16b42135
Update CHANGELOG.md 2019-10-10 10:08:45 -07:00
Martin Atkins 8664749b59 backend: Allow certain commands to opt out of required variable checks
Terraform Core expects all variables to be set, but for some ancillary
commands it's fine for them to just be set to placeholders because the
variable values themselves are not key to the command's functionality
as long as the terraform.Context is still self-consistent.

For such commands, rather than prompting for interactive input for
required variables we'll just stub them out as unknowns to reflect that
they are placeholders for values that a user would normally need to
provide.

This achieves a similar effect to how these commands behaved before, but
without the tendency to produce a slightly invalid terraform.Context that
would fail in strange ways when asked to run certain operations.
2019-10-10 10:07:01 -07:00
Martin Atkins e21f0fa61e backend/local: Handle interactive prompts for variables in UI layer
During the 0.12 work we intended to move all of the variable value
collection logic into the UI layer (command package and backend packages)
and present them all together as a unified data structure to Terraform
Core. However, we didn't quite succeed because the interactive prompts
for unset required variables were still being handled _after_ calling
into Terraform Core.

Here we complete that earlier work by moving the interactive prompts for
variables out into the UI layer too, thus allowing us to handle final
validation of the variables all together in one place and do so in the UI
layer where we have the most context still available about where all of
these values are coming from.

This allows us to fix a problem where previously disabling input with
-input=false on the command line could cause Terraform Core to receive an
incomplete set of variable values, and fail with a bad error message.

As a consequence of this refactoring, the scope of terraform.Context.Input
is now reduced to only gathering provider configuration arguments. Ideally
that too would move into the UI layer somehow in a future commit, but
that's a problem for another day.
2019-10-10 10:07:01 -07:00
Martin Atkins 564b57b1f6 core: Require variables correctly set during NewContext
We previously deferred this to Validate, but all of our operations require
a valid set of variables and so checking this up front makes it more
obvious when a call into Terraform Core from the CLI layer isn't
populating variables correctly, instead of having it fail downstream
somewhere.

It's the caller's responsibility to ensure that it has collected values
for all of the variables in some way before calling NewContext, because
in the main case driven by the CLI there are many different places that
variable values can be collected from and so handling the main user-facing
validation in the CLI allows us to return better error messages that take
into account which way a variable is (or is not) being set.
2019-10-10 10:07:01 -07:00
Jeff Green e505845a63 command/apply: remove duplicate statement (#23011) 2019-10-08 16:11:36 -04:00
Chris Griggs b6257a3e26
Merge pull request #22997 from hashicorp/cgriggs01-venafi
[Website] Add links to provider documentation
2019-10-08 12:57:17 -07:00
Pam Selle 03fa5cb7d6
Merge pull request #22966 from pselle/docs-splat
Update expression docs to clarify for_each usage
2019-10-08 15:30:42 -04:00
Kristin Laemmert 241e88e5ed
Update CHANGELOG.md 2019-10-08 13:44:46 -04:00
Kristin Laemmert a9da6f0e5b
command/jsonstate: properly marshal deposed resources (#23027)
* command/jsonstate: properly marshal deposed resources

This PR addresses 2 issues: `show -json` would crash if there was not a
`Current` `states.ResourceInstance` for a given resource, and `deposed`
resource instances were not shown at all.

Fixes #22642
2019-10-08 13:42:34 -04:00
James Bardin 1ee851f256
Merge pull request #22846 from hashicorp/jbardin/evaluate-resource
Always evaluate resources in their entirety
2019-10-08 07:57:15 -04:00
James Bardin bfce78064b lang/eval: more evalContext fixups
self references do not need to be added to `managedResource`, and in
fact that could cause issues later if self is allowed in contexts other
than managed resources.

Coalesce 2 cases in the Referenceable switch, be take the
ContainingResource address of an instance beforehand.
2019-10-07 18:13:20 -04:00
Pam Selle d6983eaaff
Update CHANGELOG.md 2019-10-07 16:07:31 -04:00
Pam Selle 43c66c2048
Merge pull request #22811 from notchairmk/b-apply-node-removed-targeted
bug: fix terraform trying to clean up orphan modules on target
2019-10-07 16:04:50 -04:00
Pam Selle 2a50bc6b5a More in expressions, removed extra resource thing 2019-10-07 14:46:20 -04:00
Pam Selle 67e314dcbe Some docs updates to clarify splat confusion 2019-10-07 14:44:33 -04:00
tf-release-bot dcb65fa9c7 Cleanup after v0.12.10 release 2019-10-07 16:23:38 +00:00
tf-release-bot 1c6e2a1eaf
v0.12.10 2019-10-07 16:12:43 +00:00