Commit Graph

24944 Commits

Author SHA1 Message Date
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
Martin Atkins b97cf967a1
Update CHANGELOG.md 2019-11-05 16:25:27 -08:00
Bastien Penavayre e7022679b2 vendor: go get github.com/mitchellh/panicwrap@v1.0.0 2019-11-05 16:22:45 -08:00
James Bardin cf49f794d7
Merge pull request #22821 from xiaozhu36/master
backend(oss): add a new field ecs_role_name to support more scenario
2019-11-05 18:11:53 -05:00
Chris Griggs fa12e9f7d9
Merge pull request #23276 from hashicorp/cgriggs01-modifiers
[Website] Community update
2019-11-04 10:57:03 -08:00
cgriggs01 a5ad6dd57b update CDA and Okta 2019-11-04 10:13:43 -08:00
He Guimin bfae627112 add a new field ecs_role_name to support more scenario 2019-11-02 00:09:46 +08:00
Pam Selle f9f7320438
Merge pull request #17911 from vkatsikaros/patch-2
Expand example explanation
2019-11-01 11:49:27 -04:00
Pam Selle 4f1d363b98 Change wording back to attach, add for_each mention 2019-11-01 11:47:46 -04:00
vkatsikaros 22321efa71 Expand example explanation
As mentioned in  #17871 the current example can hide the fact that the module
path plays an important role. The example's explanation is expanded.

Moreover, the verb "attach" is replaced with "map" to make the vocabulary
consistent with the wording in the documentation of the terraform state.
2019-11-01 11:44:39 -04:00
tf-release-bot 9bd823bc11 Cleanup after v0.12.13 release 2019-10-31 19:28:10 +00:00
tf-release-bot 5cb4596387
v0.12.13 2019-10-31 19:16:37 +00:00
Pam Selle 5070ab7989
Merge pull request #23185 from scott1138/patch-1
Update taint docs - for_each
2019-10-31 13:16:53 -04:00
Martin Atkins 6afb82ee1f
Update CHANGELOG.md 2019-10-31 09:53:25 -07:00
Martin Atkins 8f27409007 backend/remote: Support HCL variable values in local operations
For remote operations, the remote system (Terraform Cloud or Enterprise)
writes the stored variable values into a .tfvars file before running the
remote copy of Terraform CLI.

By contrast, for operations that only run locally (like
"terraform import"), we fetch the stored variable values from the remote
API and add them into the set of available variables directly as part
of creating the local execution context.

Previously in the local-only case we were assuming that all stored
variables are strings, which isn't true: the Terraform Cloud/Enterprise UI
allows users to specify that a particular variable is given as an HCL
expression, in which case the correct behavior is to parse and evaluate
the expression to obtain the final value.

This also addresses a related issue whereby previously we were forcing
all sensitive values to be represented as a special string "<sensitive>".
That leads to type checking errors for any variable specified as having
a type other than string, so instead here we use an unknown value as a
placeholder so that type checking can pass.

Unpopulated sensitive values may cause errors downstream though, so we'll
also produce a warning for each of them to let the user know that those
variables are not available for local-only operations. It's a warning
rather than an error so that operations that don't rely on known values
for those variables can potentially complete successfully.

This can potentially produce errors in situations that would've been
silently ignored before: if a remote variable is marked as being HCL
syntax but is not valid HCL then it will now fail parsing at this early
stage, whereas previously it would've just passed through as a string
and failed only if the operation tried to interpret it as a non-string.
However, in situations like these the remote operations like
"terraform plan" would already have been failing with an equivalent
error message anyway, so it's unlikely that any existing workspace that
is being used for routine operations would have such a broken
configuration.
2019-10-31 09:45:50 -07:00
Martin Atkins 9f9f22091e backend/remote: Unlock workspace if Context fails
Previously any error case in the Context method would cause us to leave
the remote workspace locked on exit, requiring manual action to unlock it.
2019-10-31 09:45:50 -07:00
Chris Griggs 74249a8c23
Merge pull request #23235 from hashicorp/cgriggs01-cherryservers
[Website] CherryServer doc links
2019-10-30 11:16:51 -07:00
cgriggs01 e3b18cd0d9 [Website] CherryServer doc links 2019-10-30 10:55:01 -07:00
James Bardin cd7c3e4231 update CHANGELOG.md 2019-10-30 11:04:51 -04:00
James Bardin 7829a4f6ce
Merge pull request #23215 from hashicorp/jbardin/for-each-self
Resource value may be an object in self evaluation
2019-10-29 12:58:25 -04:00
James Bardin 3839405d3d correctly evaluate self in for_each resources
The fallback type for GetResource from an EachMap is a cty.Object,
because resource schemas may contain dynamically typed attributes.
Check for an Object type in the evaluation of self, to use the proper
GetAttr method when extracting the value.
2019-10-29 12:44:42 -04:00
James Bardin f11c836181 failing test with for_each self reference 2019-10-29 12:14:30 -04:00
Martin Atkins ce68b4d27c config: Remove legacy interpolation function implementations
These are often confusing for new contributors, since this looks
suspiciously like the right place to add new functions or change the
behavior of existing ones.

To reduce that confusion, here we remove them entirely from this package
(which is now dead code in Terraform 0.12 anyway) and include in the
documentation comments a pointer to the current function implementations.
2019-10-29 08:25:45 -07:00
Martin Atkins f8a32f0b83 website: Consistently recommend the required_providers block
Previously we were inconsistent in whether we were recommending the
new required_providers block or the "version" setting inside a "provider"
block.
2019-10-28 15:56:12 -07:00
Martin Atkins 7c110f9cf8 website: provider version constraints in modules 2019-10-28 15:56:12 -07:00
Thomas Alton ddd0d2a442 website: Provider proxy config only supports alias 2019-10-28 15:56:12 -07:00
Thomas Alton 24386bcfcb website: Link to `required_providers` block from provider documentation 2019-10-28 15:56:12 -07:00
Colby Rome d58d91a6b2 website: Fix a missing word in the Module Composition page 2019-10-28 15:19:26 -07:00
Pam Selle e44800a696
Merge pull request #23209 from pselle/docs-address
Quote differently so render works on taint docs
2019-10-28 16:56:44 -04:00
Chris Griggs 334c8e9dbb
Merge pull request #23212 from hashicorp/cgriggs01-dome9-links
[Website] Dome9 provider links
2019-10-28 13:22:44 -07:00
Justin Campbell 07624eeb31
website: Add Terraform Registry Provider Docs page (#23139)
Co-Authored-By: Kim Ngo <kngo@hashicorp.com>
Co-Authored-By: Nick Fagerlund <nick@hashicorp.com>
2019-10-28 16:05:22 -04:00
cgriggs01 7e53919912 [Website] Dome9 provider links 2019-10-28 10:45:25 -07:00
Pam Selle 22ae5cf52d Quote differently so render works 2019-10-28 13:04:38 -04:00
Chris Griggs 8a34c33ad3
Merge pull request #23183 from hashicorp/cgriggs01-vultr-links
[Website] Vultr provider links
2019-10-24 13:20:08 -07:00
Pam Selle 5b453f6ba9
Merge pull request #23186 from pselle/pselle/docs-syntax-link
Docs around splat and for_each
2019-10-24 16:15:18 -04:00
Pam Selle 566f22a34e Docs around splat 2019-10-24 16:09:34 -04:00
scott1138 c6baf28508
Update taint docs - for_each
Provide an explanation of how to taint a resource created with for_each
2019-10-24 14:53:45 -05:00
Chris Griggs 7dac6eed82
Update fix 2019-10-24 12:03:43 -07:00
cgriggs01 67105ceeae [Website] Vultr provider links 2019-10-24 12:00:35 -07:00
James Bardin 744b835e17
Merge pull request #22937 from hashicorp/jbardin/cbd-modules
create_before_destroy across modules
2019-10-24 12:23:01 -04:00
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
Pam Selle 491a739659
Update CHANGELOG.md 2019-10-24 12:04:23 -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