Commit Graph

25092 Commits

Author SHA1 Message Date
Robert Tillery af77d1d22c backend/remote: Filter environment variables when loading context (#23358)
* backend/remote: Filter environment variables when loading context

Following up on #23122, the remote system (Terraform Cloud or
Enterprise) serves environment and Terraform variables using a single
type of object. We only should load Terraform variables into the
Terraform context.

Fixes https://github.com/hashicorp/terraform/issues/23283.
2019-11-13 11:34:09 -05:00
Martin Atkins b09626b0cc
Update CHANGELOG.md 2019-11-13 08:05:27 -08:00
Martin Atkins 91752f02da configs: Warn for deprecated interpolation and quoted type constraints
Following on from de652e22a26b, this introduces deprecation warnings for
when an attribute value expression is a template with only a single
interpolation sequence, and for variable type constraints given in quotes.

As with the previous commit, we allowed these deprecated forms with no
warning for a few releases after v0.12.0 to ensure that folks who need to
write cross-compatible modules for a while during upgrading would be able
to do so, but we're now marking these as explicitly deprecated to guide
users towards the new idiomatic forms.

The "terraform 0.12upgrade" tool would've already updated configurations
to not hit these warnings for those who had pre-existing configurations
written for Terraform 0.11.

The main target audience for these warnings are newcomers to Terraform who
are learning from existing examples already published in various spots on
the wider internet that may be showing older Terraform syntax, since those
folks will not be running their configurations through the upgrade tool.
These warnings will hopefully guide them towards modern Terraform usage
during their initial experimentation, and thus reduce the chances of
inadvertently adopting the less-readable legacy usage patterns in
greenfield projects.
2019-11-13 07:55:55 -08:00
Calle Pettersson 73d574913d configs: Mention leading underscores in invalid identifier message 2019-11-11 16:22:33 -08:00
sixcorners ae5f43ba25 build: Don't create apk cache in "full" docker image 2019-11-11 16:04:23 -08:00
Martin Atkins f9424194e9
Update CHANGELOG.md 2019-11-11 15:27:14 -08:00
aqche bcaf7f7ba7 states/statemgr: Properly return error when Unlock detects invalid lock id 2019-11-11 15:24:53 -08:00
Martin Atkins 61a760938f
Update CHANGELOG.md 2019-11-11 10:26:05 -08:00
Martin Atkins 79dc808614 configs: Emit warnings for deprecated quoted references/keywords
Terraform 0.12.0 removed the need for putting references and keywords
in quotes, but we disabled the deprecation warnings for the initial
release in order to avoid creating noise for folks who were intentionally
attempting to maintain modules that were cross-compatible with both
Terraform 0.11 and Terraform 0.12.

However, with Terraform 0.12 now more widely used, the lack of these
warnings seems to be causing newcomers to copy the quoted versions from
existing examples on the internet, which is perpetuating the old and
confusing quoted form in newer configurations.

In preparation for phasing out these deprecated forms altogether in a
future major release, and for the shorter-term benefit of giving better
feedback to newcomers when they are learning from outdated examples, we'll
now re-enable those deprecation warnings, and be explicit that the old
forms are intended for removal in a future release.

In order to properly test this, we establish a new set of test
configurations that explicitly mark which warnings they are expecting and
verify that they do indeed produce those expected warnings. We also
verify that the "success" tests do _not_ produce warnings, while removing
the ones that were previously written to succeed but have their warnings
ignored.
2019-11-11 10:17:34 -08:00
Martin Atkins 2423f266fb website: example of "terraform taint" with a grandchild module
I've seen folks ask about how to express this in resource address syntax
a number of times now, so adding this example here to illustrate how it
looks when there are multiple levels of module to traverse through.

This is redundant with other information further up the page, but having
it as an entirely separate example gives an opportunity to include more
introductory text to explain what the example is showing.
2019-11-11 10:12:11 -08:00
Martin Atkins 6f66aad032
Update CHANGELOG.md 2019-11-08 16:42:42 -08:00
Ethan 6833ac290b command: Use full URL for the download page when prompting for upgrade
This makes it more likely that a terminal emulator will detect the URL as a clickable link.
2019-11-08 16:10:39 -08:00
Martin Atkins b5830484b8
Update CHANGELOG.md 2019-11-08 16:06:31 -08:00
Thayne McCombs a895a42f85 command/format: fix missing elements at the end of lists in diffs 2019-11-08 16:05:23 -08:00
Chris Griggs 3e00447789
Merge pull request #23327 from hashicorp/cgriggs01-website
[Website] Provider links
2019-11-08 14:37:22 -08:00
cgriggs01 ebb0ca2d23 [Website] Provider links 2019-11-08 14:33:04 -08:00
Chris Griggs 89dbb52191
Merge pull request #23323 from hashicorp/cgriggs01-vthunder
[Website] vThunder links
2019-11-08 10:40:54 -08:00
cgriggs01 4a46d0c212 [Website] vThunder links 2019-11-08 10:18:07 -08:00
Yuki Ito 72c910cebc website: Fix typographical errors in the docs for base64sha256/512 2019-11-08 09:43:27 -08:00
Martin Atkins 515163d8e8
Update CHANGELOG.md 2019-11-08 09:42:06 -08:00
Parviz 6eaf1c23f9 lang/funcs: don't panic when transpose produces empty result 2019-11-08 09:40:39 -08:00
James Bardin 9ff83d8308 update CHANGELOG.md 2019-11-08 12:27:02 -05:00
James Bardin d0fc3d6919
Merge pull request #23304 from hashicorp/jbardin/tainted-fail-destroy
Make sure a failed destroy is marked as tainted
2019-11-08 10:51:18 -05:00
James Bardin cbd64c0d3c restore the prior tainted status on failed apply 2019-11-08 10:33:27 -05:00
James Bardin 84b5de9ae4 simplify EvalMaybeTainted logic
The EvalMaybeTainted logic was confusing, with deep nesting and unneeded
duplicate fields.
2019-11-08 10:29:01 -05:00
James Bardin 4b04e3fa59 failing tests for destroying tainted resources
If a tainted resource fails to destroy, it loses the tainted status
2019-11-08 10:29:01 -05:00
James Bardin bee703360c
Merge pull request #23252 from hashicorp/jbardin/abs-state-dependencies
store absolute addresses for resource dependencies in the state
2019-11-08 10:25:32 -05:00
Martin Atkins 7db2825646 command/format: multi-line rendering for unchanged strings
We have a special treatment for multi-line strings that are being updated
in-place where we show them across multiple lines in the plan output, but
we didn't use that same treatment for rendering multi-line strings in
isolation such as when they are being added for the first time.

Here we detect when we're rendering a multi-line string in a no-change
situation and render it using the diff renderer instead, using the same
value for old and new and thus producing a multi-line result without any
diff markers at all.

This improves consistency between the change and no-change cases, and
makes multi-line strings (such as YAML in block mode) readable in all
cases.
2019-11-07 15:25:40 -08:00
James Bardin 46dbb3dde5 use Dependencies to connect creator and destroyer
The DestroyEdgeTransformer cannot determine ordering from the graph when
the destroyers are from orphaned resources, because there are no
references to resolve. The new stored Dependencies provides what we need
to connect the instances in this case.

We also add the StateDependencies method directly in the
GraphNodeResourceInstance interface, since all instances already
implement this, and we don't need another optional interface to check.

The old code in DestroyEdgeTransformer may no longer be needed in the
long run, but that can be determined separately, since too many of the
tests start with an incomplete state and rely on the Dependencies being
determined from the configuration alone.
2019-11-07 17:49:03 -05:00
James Bardin 10152da478 failing test for update from orphaned instance
Updates resulting from orphaned instances should happen after the
deletion of the instances.
2019-11-07 17:49:03 -05:00
James Bardin 5e16e8eece append dependencies during refresh
Refresh should load any new dependencies found because of configuration
or state changes, but retain any dependencies already in the state.
Orphaned resources would not be in config, but we do not want to lose
the destroy ordering for the later apply.
2019-11-07 17:49:03 -05:00
James Bardin 886af20f07 fixup some test comparisons 2019-11-07 17:49:03 -05:00
James Bardin 16b368e292 only need to handle depends_on to shim old state 2019-11-07 17:49:03 -05:00
James Bardin 42bb4a644c make use of the new state Dependencies
Make use of the new Dependencies field in the instance state.

The inter-instance dependencies will be determined from the complete
reference graph, so that absolute addresses can be stored, rather than
just references within a module. The Dependencies are added to the node
in the same manner as state, i.e. via an "attacher" interface and
transformer.  This is because dependencies are calculated from the graph
itself, and not from the config.
2019-11-07 17:49:03 -05:00
James Bardin 5a0a0020a0 read+write the new dependencies in the statefile
The test fixture did not like having modules when using the generic json
map, so read and compare the states in the final *File datastructure.
2019-11-07 17:49:03 -05:00
andrewjkeith 6cb9aaacfe website: Fix extension_requests argument name for Puppet provisioner 2019-11-06 17:14:12 -08:00
Lars Lehtonen 1219acf467 backend/atlas: fix use of T.Fatal() inside goroutine 2019-11-06 17:11:15 -08:00
Paddy ba7679b679 website: Remove reference to the now-deprecated pgp_key provider design pattern 2019-11-06 17:05:09 -08:00
Roger Berlind de4ef9c546 website: Clarify workspace concepts for remote backend
There are some differences between the Terraform CLI and Terraform Cloud ideas of workspaces.

This documentation aims to explain those differences and show different patterns for configuring the remote backend and the implications of different approaches.
2019-11-06 17:03:20 -08:00
Martin Atkins dbff07c841
Update CHANGELOG.md 2019-11-06 16:30:41 -08:00
Josh Grancell ac3578a0bc command/output: Absence of outputs is not an error 2019-11-06 16:26:32 -08:00
Martin Atkins 21228b473a
Update CHANGELOG.md 2019-11-06 14:19:52 -08:00
Joaquín Fernández Campo d2bc7c25b9 backend/artifactory: Honor HTTP_PROXY and HTTPS_PROXY environment variables 2019-11-06 14:18:33 -08:00
Kent 'picat' Gruber a7f935c63b main: Warn about potential sensitive information in logs when panicking 2019-11-06 14:12:33 -08:00
James Bardin 2d9d6d7afe
Merge pull request #23302 from hashicorp/jbardin/provisioner-utf8
sanitize provisioner output strings
2019-11-06 15:14:29 -05:00
James Bardin 49439d02d1 sanitize provisioner output strings
The grpc protocol requires strings to be valid utf8, but because
provisioners often don't have control over the command output, invalid
utf8 sequences can make it into the response causing grpc transport
errors.

Replace all invalid utf sequences with the standard utf replacement
character in the provisioner output. The code is a direct copy from the
go1.13 std library, and can be replaced with strings.ToValidUTF8 once
it's available.
2019-11-06 14:57:52 -05:00
Martin Atkins 2de4a28860 Build with Go 1.12.13
This is the latest 1.12 minor release at the time of writing. We are not
yet upgrading to Go 1.13 because it ends support for MacOS 10.10 and
earlier (Yosemite) and for versions of FreeBSD prior to 11.2, and so we
need to make that switch with care to properly phase those out as
supported platforms in Terraform too.
2019-11-06 07:02:54 -08:00
Martin Atkins 3a54047984
Update CHANGELOG.md 2019-11-06 06:57:14 -08:00
Martin Atkins d0cbbb6a00 command/format: Remove defunct "Plan" type and associated symbols
This "Plan" type, along with the other types it directly or indirectly
embeds and the associated functions, are adaptations of the
flatmap-oriented plan renderer logic from Terraform 0.11 and prior.

The current diff rendering logic is in diff.go, and so the contents of the
plan.go file are defunct apart from the DiffActionSymbol function that
both implementations share. Therefore here we move DiffActionSymbol into
diff.go and then remove plan.go entirely, in the interests of dead code
removal.
2019-11-06 06:53:32 -08:00
Martin Atkins 9a62ab3014 command: "terraform show" renders plans like "terraform plan"
During the Terraform 0.12 work we briefly had a partial update of the old
Terraform 0.11 (and prior) diff renderer that could work with the new
plan structure, but could produce only partial results.

We switched to the new plan implementation prior to release, but the
"terraform show" command was left calling into the old partial
implementation, and thus produced incomplete results when rendering a
saved plan.

Here we instead use the plan rendering logic from the "terraform plan"
command, making the output of both identical.

Unfortunately, due to the current backend architecture that logic lives
inside the local backend package, and it contains some business logic
around state and schema wrangling that would make it inappropriate to move
wholesale into the command/format package. To allow for a low-risk fix to
the "terraform show" output, here we avoid some more severe refactoring by
just exporting the rendering functionality in a way that allows the
"terraform show" command to call into it.

In future we'd like to move all of the code that actually writes to the
output into the "command" package so that the roles of these components
are better segregated, but that is too big a change to block fixing this
issue.
2019-11-06 06:53:32 -08:00