Commit Graph

21894 Commits

Author SHA1 Message Date
Martin Atkins e309675853 tfdiags: Contextual diagnostics
The usual usage of diagnostics requires us to pass around source location
information to everywhere that might generate a diagnostic, and that is
always the best way to get the most precise diagnostic source locations.

However, it's impractical to require source location information to be
retained in every Terraform subsystem, and so this new idea of "contextual
diagnostics" allows us to separate the generation of a diagnostic from
the resolution of its source location, instead resolving the location
information as a post-processing step once the call stack unwinds to a
place where there is enough context to find it.

This is necessarily a less precise approach than reading the source ranges
directly from the configuration AST, but gives us an alternative to no
diagnostics at all in portions of Terraform where full location
information is not available.

This is a best-effort sort of thing which will get as precise as it can
but may return a range in a parent block if the precise location of a
particular attribute cannot be found. Diagnostics that rely on this
mechanism should include some other contextual information in the detail
message to make up for any loss of precision that results.
2018-10-16 18:24:10 -07:00
Martin Atkins b41f08d79d govendor fetch github.com/zclconf/go-cty/... 2018-10-16 18:24:10 -07:00
James Bardin a79d620f03 remove legacy remote state code 2018-10-16 18:24:10 -07:00
James Bardin 979faa5dbe move artifactory remote state to backend 2018-10-16 18:23:14 -07:00
James Bardin 178eb6076e remove legacy remote file code
This code is not referenced at all
2018-10-16 18:22:37 -07:00
James Bardin 18ef072325 move legacy http remote state to a backend 2018-10-16 18:22:37 -07:00
James Bardin 3595bd3f81 remove dead legacy gcs code 2018-10-16 18:21:51 -07:00
James Bardin fe527ec9d7 move legacy etcd remote state to a backend 2018-10-16 18:21:51 -07:00
Martin Atkins 9a004e3f9d command: "terraform validate" JSON support
In the long run we'd like to offer machine-readable output for more
commands, but for now we'll just start with a tactical feature in
"terraform validate" since this is useful for automated testing scenarios,
editor integrations, etc, and doesn't include any representations of types
that are expected to have breaking changes in the near future.
2018-10-16 18:20:32 -07:00
Martin Atkins bfd9392eb8 command: beginnings of new config loader in "terraform validate"
As part of some light reorganization of our commands, this new
implementation no longer does validation of variables and will thus avoid
the need to spin up a fully-valid context. Instead, its focus is on
validating the configuration itself, regardless of any variables, state,
etc.

This change anticipates us later adding a -validate-only flag to
"terraform plan" which will then take over the related use-case of
checking if a particular execution of Terraform is valid, _including_ the
state, variables, etc.

Although leaving variables out of validate feels pretty arbitrary today
while all of the variable sources are local anyway, we have plans to
allow per-workspace variables to be stored in the backend in future and
at that point it will no longer be possible to fully validate variables
without accessing the backend. The "terraform plan" command explicitly
requires access to the backend, while "terraform validate" is now
explicitly for local-only validation of a single module.

In a future commit this will be extended to do basic type checking of
the configuration based on provider schemas, etc.
2018-10-16 18:20:32 -07:00
Martin Atkins fd5b7b42b8 command: new Meta methods for accessing the new config loader
We need to share a single config loader across all callers because that
allows us to maintain the source code cache we'll use for snippets in
error messages.

Nothing calls this yet. Callers will be gradually updated away from Module
and Config in subsequent commits.
2018-10-16 18:20:32 -07:00
Martin Atkins bd10b84a8e command/format: include source snippets in diagnostics
If we get a diagnostic message that references a source range, and if the
source code for the referenced file is available, we'll show a snippet of
the source code with the source range highlighted.

At the moment we have no cache of source code, so in practice this
codepath can never be visited. Callers to format.Diagnostic will be
gradually updated in subsequent commits.
2018-10-16 18:20:32 -07:00
Martin Atkins fff2ed1d7e Update CHANGELOG.md 2018-10-16 18:20:32 -07:00
Martin Atkins 6a6d21fb0a version: change to 0.12.0 to mark the beginning of the 0.12 dev branch 2018-10-16 18:20:10 -07:00
Sander van Harmelen 2b128f3bfb
Update CHANGELOG.md 2018-10-17 00:03:39 +02:00
Sander van Harmelen 6d4dffb93e
Merge pull request #19088 from hashicorp/f-plan-policy
backend/remote: make sure we also output policies while planning
2018-10-17 00:01:20 +02:00
Luke Kysow 3eafbf3861 Add link to Terraform's GitHub Actions docs (#19091) 2018-10-16 10:36:04 -07:00
Sander van Harmelen 8875fa660f Make sure we also output policies while planning 2018-10-16 17:16:28 +02:00
Paul Tyng 87d05607d3
Add missing Azure entry to changelog 2018-10-16 09:13:57 -04:00
Sander van Harmelen 3d3c748ffe release: clean up after v0.11.9-beta1 2018-10-15 23:09:59 +02:00
Sander van Harmelen 48c1ae62b3 v0.11.9-beta1 2018-10-15 21:04:37 +02:00
Sander van Harmelen 7e4bff54cd
Merge pull request #19079 from hashicorp/f-header
backend/remote: improve console output
2018-10-15 20:47:14 +02:00
Sander van Harmelen 775f8a9626 Make sure we always set a custom header
This is for TFE to recognize were the calls come from.
2018-10-15 20:33:42 +02:00
Sander van Harmelen 0a59e54933 Improve the output just a bit 2018-10-15 19:56:59 +02:00
Sander van Harmelen cdf997a97c govendor: update `go-tfe` 2018-10-15 19:26:06 +02:00
Paul Tyng f74774ff4f
Merge pull request #18877 from gsacavdm/update-goautorest
Update go-autorest to v9.10.0
2018-10-15 12:53:53 -04:00
Sander van Harmelen 7b55d1640e
Merge pull request #19060 from hashicorp/f-stx-etx
backend/remote: update `go-tfe` to support better log polling
2018-10-11 23:11:52 +02:00
Sander van Harmelen c08cd597c5 Omit any empty lines containing STX/ETX markers 2018-10-11 22:08:09 +02:00
Sander van Harmelen 8826d67acf govendor: update `go-tfe` 2018-10-11 22:07:22 +02:00
Sander van Harmelen 5e511e1ea1
Update CHANGELOG.md 2018-10-11 20:36:29 +02:00
Sander van Harmelen c3e9d78873
Merge pull request #19047 from hashicorp/f-watch-queues
backend/remote: print status updates while waiting for the run to start
2018-10-11 20:31:07 +02:00
Sander van Harmelen fb0af07696 Print status updates while waiting for the run to start 2018-10-11 13:41:48 +02:00
Sander van Harmelen 62656a6ce8
Update CHANGELOG.md 2018-10-11 12:52:22 +02:00
Sander van Harmelen 56e6c60f76
Merge pull request #18533 from alice-sawatzky/master
change chef linux provisioner to use user:group chown syntax
2018-10-11 10:29:01 +02:00
Sander van Harmelen 5eb49f9df5 govendor: update `go-tfe` 2018-10-10 19:45:22 +02:00
Sander van Harmelen 617aaa6839
Update CHANGELOG.md 2018-10-10 18:56:19 +02:00
Sander van Harmelen 4586b9f65a
Merge pull request #19035 from hashicorp/f-policy-override
backend/remote: don’t ask questions when -auto-approve is set
2018-10-10 18:55:34 +02:00
Chris Griggs 15dda63358
Merge pull request #19044 from cgriggs01/cgriggs01-add-helm
add helm links
2018-10-09 17:07:43 -07:00
cgriggs01 87191d46cd add helm links 2018-10-09 16:57:54 -07:00
Chris Griggs af2e504296
Merge pull request #19039 from cgriggs01/cgriggs01-nutanix-links
[Website] New Nutanix Provider Links
2018-10-09 15:20:01 -07:00
cgriggs01 24c360ec8d add nutanix links 2018-10-09 14:29:52 -07:00
Sander van Harmelen d78470ad5a Don’t ask questions when -auto-approve is set
We previously asked to override a soft-failed policy, even wehn -auto-approve was set. That is now fixed by returning a policy failed error.
2018-10-09 20:12:33 +02:00
Sander van Harmelen 4ff43440be
Update CHANGELOG.md 2018-10-09 09:43:37 +02:00
Sander van Harmelen 53a8aaaf85
Merge pull request #19022 from hashicorp/f-auto-apply
backend/remote: properly handle workspaces that auto apply changes
2018-10-09 09:43:25 +02:00
Sander van Harmelen c03a89c788
Merge pull request #19014 from hashicorp/f-exit-code
backend/remote: allow enhanced backends to pass custom exit codes
2018-10-09 09:42:17 +02:00
Sander van Harmelen 194863db4e Properly handle workspaces that auto apply changes
This commit adds logic to check if a workspace is configured to auto apply changes. And if it does, we make sure we output all steps correctly.
2018-10-08 12:31:21 +02:00
Sander van Harmelen b1fdbd7db8 Allow enhanced backends to pass custom exit codes
In some cases this is needed to keep the UX clean and to make sure any remote exit codes are passed through to the local process.

The most obvious example for this is when using the "remote" backend. This backend runs Terraform remotely and stream the output back to the local terminal.

When an error occurs during the remote execution, all the needed error information will already be in the streamed output. So if we then return an error ourselves, users will get the same errors twice.

By allowing the backend to specify the correct exit code, the UX remains the same while preserving the correct exit codes.
2018-10-05 20:44:12 +02:00
Sander van Harmelen e0b7475984
Merge pull request #19013 from hashicorp/f-check-errors
backend/remote: add checks for all flags we currently don’t support
2018-10-05 20:37:53 +02:00
Sander van Harmelen 5239462dd9
Update CHANGELOG.md 2018-10-05 20:27:42 +02:00
Sander van Harmelen 67db9da000 Add checks for all flags we currently don’t support
For Plan only:
-module-depth=n

For Plan & Apply
-parallelism=m
-refresh=false
-var “foo=bar” and -var-file=foo
2018-10-05 20:16:34 +02:00