Commit Graph

26074 Commits

Author SHA1 Message Date
samir elsharkawy 5dfc266da9 config/name_values: fix index out of range in looksLikeSentences 2020-06-05 13:29:43 +02:00
James Bardin 023454a3a6
Merge pull request #25138 from hashicorp/jbardin/module-data-depends-on
Data source within modules using depends_on
2020-06-04 21:54:04 -04:00
James Bardin c3ec4d8e26 get whether parent modules have depends_on set
During refresh, data sources need to know if their parent modules have
depends_on configured at all. Pass this info back through the search for
depends_on resources, and delay refresh when it's set.
2020-06-04 18:07:06 -04:00
James Bardin 4637be4377 add a way to force depends_on behavior of data
Resources that are not yet created will not be in the graph during
refresh, and therefore cannot be attached to the data source nodes. In
this case we still need to indicate if there are depends_on entries
inherited from the module call, which we can do with the forceDependsOn
field.
2020-06-04 18:03:32 -04:00
James Bardin e74ebe1787 get more depends_on info for data source
Since data sources may be read during refresh or early in plan, they
need to know if there are any inherited dependencies from containing
modules too.
2020-06-04 18:03:14 -04:00
James Bardin a03c86f612 add DependsOn method to moduleExpandModule
We'll need this again for getting the transitive depends_on references
from parent module calls. This is needed to inform us how to handle data
sources during refresh and plan.
2020-06-04 18:03:03 -04:00
James Bardin 535267e986 add dependsOn to evalDataRead
this is also needed during refresh, so move it into the base struct type
2020-06-04 18:03:03 -04:00
James Bardin 58babccc7a improve depends_on test to check ordering 2020-06-04 18:03:03 -04:00
Lars Lehtonen 3ddfa66ca4
internal/modsdir: Fix Dropped Error (#24600)
* internal/modsdir: fix dropped error

* fix typo to unmarshalling

Co-authored-by: Daniel Dreier <danieldreier@users.noreply.github.com>
2020-06-04 10:26:26 -04:00
Shunsuke Miyoshi dc3ce1bbf7
command/refresh: fix state file path (#22885)
* fix default state file path for refresh command
2020-06-04 10:24:53 -04:00
Alisdair McDiarmid b3d3d6460e Update CHANGELOG.md 2020-06-04 08:52:49 -04:00
Alisdair McDiarmid fbb966b97b command: Fix 0.13upgrade usage 2020-06-04 08:51:24 -04:00
Alisdair McDiarmid 9b73e68ce9
Merge pull request #25127 from minamijoyo/add-yes-to-0.13upgrade-help
Add `-yes` flag to 0.13upgrade help message
2020-06-04 08:44:22 -04:00
Masayuki Morita f266956a5d Add `-yes` flag to 0.13upgrade help message
It seems to be implemented but not shown in help message.

FYI: A help message for 0.12upgrade command on the 0.12 branch.
https://github.com/hashicorp/terraform/blob/v0.12.26/command/012_config_upgrade.go#L235-L243
2020-06-04 11:11:46 +09:00
Alvin Huang 73ccbd146f Cleanup after v0.13.0-beta1 release 2020-06-03 14:43:54 -04:00
hashicorp-ci 4befa3c7d9
Release v0.13.0-beta1 2020-06-03 18:10:37 +00:00
Alisdair McDiarmid 6f04215cc0
Update CHANGELOG.md 2020-06-03 11:54:10 -04:00
Alisdair McDiarmid c921c8580e
Merge pull request #25112 from hashicorp/alisdair/support-openssh-rsa-key-encoding
lang/funcs: Add support for OpenSSH RSA key format
2020-06-03 11:52:10 -04:00
Alisdair McDiarmid de0e67e5f6
Merge pull request #25110 from hashicorp/alisdair/credentials-source-nil-receiver
command: Fix panic for nil credentials source
2020-06-03 11:51:49 -04:00
Alisdair McDiarmid a4f5e04066 lang/funcs: Add support for OpenSSH RSA key format
Previously this function only supported the x509 RSA private key format.
More recent versions of OpenSSH default to generating a new PEM key
format, which this commit now supports using the x/crypto/ssh package.

Also improve the returned error messages for various invalid ciphertext
or invalid private key errors.
2020-06-03 10:50:38 -04:00
Alisdair McDiarmid f1f24df7ff main: Pass untyped nil for missing creds source
If we are unable to create a credentials source for some reason, we can
rely on the disco object to nil-check it before calling any of its
methods. However to do this we must ensure that we pass untyped nil.
This commit rearranges the initialization to ensure that this happens.

The user-facing bug that triggered this work is that running init when
the HOME environment variable is unset would result in a panic on macOS.
2020-06-03 09:46:53 -04:00
Kristin Laemmert 6fbd3942ea configs: fix panic with provider aliases
addProviderRequirements() was incorrectly using the map keys from the module
provider configs when looking up the provider FQN. The map keys include
alias, so this resulted in a panic. Update addProviderRequirements() to
use the provider's name (only) when looking up the FQN.
2020-06-02 10:55:31 -04:00
Kristin Laemmert daa57ba9f6
terraform: fix panic with the combination of non extant resource and dynamics (#25097) 2020-06-02 09:01:12 -04:00
Martin Atkins 7f91090c5c
Update CHANGELOG.md 2020-06-01 14:52:43 -07:00
Martin Atkins cdad6e5860
Update CHANGELOG.md 2020-06-01 14:51:11 -07:00
Martin Atkins 49e2e00231 command: terraform providers mirror
This new command is intended to make it easy to create or update a mirror
directory containing suitable providers for the current configuration,
producing a layout that is appropriate both for a filesystem mirror or,
if copied into the document root of an HTTP server, a network mirror.

This initial version is not customizable aside from being able to select
multiple platforms to install packages for.

Future iterations of this could include commands to turn the JSON index
generation on and off, or to instruct it to produce the unpacked directory
layout instead of the packed directory layout as it currently does. Both
of those options would make the generated directory unsuitable to be
a network mirror, but it would still work as a filesystem mirror.

In the long run this will hopefully form part of a replacement workflow to
terraform-bundle as a way to put copies of providers somewhere so we don't
need to re-download them every time, but some other changes will be needed
outside of just this command before that'd be true, such as adding support
for network and/or filesystem mirrors in Terraform Enterprise.
2020-06-01 14:49:43 -07:00
Martin Atkins 85af77386c internal/getproviders: PackageFilePathForPackage
This is the equivalent of UnpackedDirectoryPathForPackage when working
with the packed directory layout. It returns a path to a .zip file with
a name that would be detected by SearchLocalDirectory as a
PackageLocalArchive package.
2020-06-01 14:49:43 -07:00
Martin Atkins 9489672d54 internal/getproviders: Package hashing for local filesystem packages
We previously had this functionality available for cached packages in the
providercache package. This moves the main implementation of this over
to the getproviders package and then implements it also for PackageMeta,
allowing us to compute hashes in a consistent way across both of our
representations of a provider package.

The new methods on PackageMeta will only be effective for packages in the
local filesystem because we need direct access to the contents in order
to produce the hash. Hopefully in future the registry protocol will be
able to also provide hashes using this content-based (rather than
archive-based) algorithm and then we'll be able to make this work for
PackageMeta referring to a package obtained from a registry too, but
hashes for local packages only are still useful for some cases right now,
such as generating mirror directories in the "terraform providers mirror"
command.
2020-06-01 14:49:43 -07:00
Martin Atkins 67311f73fd website: Draw better attention to for and for_each patterns
When helping folks in the community forum, I commonly see questions around
more complex patterns in transforming deep data structures into different
shapes to work with for_each. We have examples of these patterns in the
docs for the functions that they rely on, but they were not previously
very discoverable in the main configuration language documentation
sections.

Here I've moved the "Using Expressions in for_each" subsection on the
Resources page above some of the other sub-sections to hopefully make it
easier to see, and written out in more detail the two specific patterns
that answer a significant number of for_each-related user questions in
the hope that readers will be more likely to realize that the links are
relevant to what their goals.

I also added some more elaboration about the behavior of converting from
list to set in the "Using Sets" subsection, because this feature is often
a user's first encounter with the set data type and I've inferred from
some of the questions I've answered that a number of Terraform users don't
have prior experience with set data types in other languages to draw
assumptions from.

Finally, I added some similar links to the for_each patterns within the
for expression documentation itself, to try to make those examples more
visible to those who might be discovering the documentation in a different
sequence, e.g. by following a deep link shared in an answer to a question
in the community forum.
2020-06-01 14:17:47 -07:00
Alisdair McDiarmid ded30b6836
Merge pull request #25103 from hashicorp/alisdair/fix-012upgrade-stub
command: Fix 0.12upgrade stub
2020-06-01 16:18:12 -04:00
Alisdair McDiarmid 5e2b11657e command: Fix 0.12upgrade stub 2020-06-01 16:12:30 -04:00
Kristin Laemmert f86fb6161b
Merge pull request #25087 from WillBrock/wb-provider-typo
website/docs: Fix doc typo replacing "and" with "as"
2020-06-01 12:57:51 -04:00
Will Brock b4dd2b8b2e
Fix typo replacing and with as 2020-05-30 18:10:51 -04:00
James Bardin 866449a78a
Merge pull request #25069 from hashicorp/jbardin/depends-on-docs
depends_on doc updates
2020-05-29 16:50:39 -04:00
Pam Selle 5883099ce5
Update CHANGELOG.md 2020-05-29 15:34:13 -04:00
Pam Selle 195b59e5f2
Merge pull request #25078 from hashicorp/pselle/jsonencode
[vendor] upgrade go-cty
2020-05-29 15:32:45 -04:00
Pam Selle 5e8b60ba07 Upgrade go-cty for jsonencode fix, closes #23062 2020-05-29 13:00:12 -04:00
James Bardin 3046b790b1
Merge pull request #25018 from hashicorp/jbardin/destroy-modules
Destroy nested, expanding modules
2020-05-29 12:44:13 -04:00
Kristin Laemmert 020084f6d0 update e2etests for windows compatibility 2020-05-29 11:57:50 -04:00
Alisdair McDiarmid 83482770c4
Merge pull request #25055 from hashicorp/alisdair/detected-legacy-provider-on-init
command/init: Better diagnostics for provider 404s
2020-05-29 11:57:18 -04:00
Martin Atkins fd26df0bc4
Update CHANGELOG.md 2020-05-29 07:42:46 -07:00
Martin Atkins 89c2a61b41 website: Small corrections to the "plan" and "apply" command docs
The "apply" documentation contained a simple typo, while the "plan"
documentation contained outdated information about using
"terraform plan PLANFILE" to view a plan. The latter is now a separate
command entirely, since Terraform 0.12: "terraform show PLANFILE".
2020-05-29 07:36:40 -07:00
Martin Atkins 31a4b44d2e backend/local: treat output changes as side-effects to be applied
This is a baby-step towards an intended future where all Terraform actions
which have side-effects in either remote objects or the Terraform state
can go through the plan+apply workflow.

This initial change is focused only on allowing plan+apply for changes to
root module output values, so that these can be written into a new state
snapshot (for consumption by terraform_remote_state elsewhere) without
having to go outside of the primary workflow by running
"terraform refresh".

This is also better than "terraform refresh" because it gives an
opportunity to review the proposed changes before applying them, as we're
accustomed to with resource changes.

The downside here is that Terraform Core was not designed to produce
accurate changesets for root module outputs. Although we added a place for
it in the plan model in Terraform 0.12, Terraform Core currently produces
inaccurate changesets there which don't properly track the prior values.

We're planning to rework Terraform Core's evaluation approach in a
forthcoming release so it would itself be able to distinguish between the
prior state and the planned new state to produce an accurate changeset,
but this commit introduces a temporary stop-gap solution of implementing
the logic up in the local backend code, where we can freeze a snapshot of
the prior state before we take any other actions and then use that to
produce an accurate output changeset to decide whether the plan has
externally-visible side-effects and render any changes to output values.

This temporary approach should be replaced by a more appropriately-placed
solution in Terraform Core in a release, which should then allow further
behaviors in similar vein, such as user-visible drift detection for
resource instances.
2020-05-29 07:36:40 -07:00
James Bardin 1bbb59fc1b remove extra whitespace 2020-05-29 10:31:10 -04:00
James Bardin acd3dca567 remove unused closer field 2020-05-29 10:29:27 -04:00
James Bardin 3dbd6ea3a9 remove stale comment 2020-05-29 10:18:33 -04:00
Alisdair McDiarmid cdfc2e9abd
Merge pull request #25065 from hashicorp/alisdair/remove-dead-code-plugin-discovery
plugin/discovery: Remove dead code
2020-05-29 10:18:15 -04:00
James Bardin 46d27fe848 update CHANGELOG.md 2020-05-28 22:34:13 -04:00
James Bardin 9cb7851b02 update CHANGELOG.md 2020-05-28 22:33:21 -04:00
James Bardin 74ae34865d re-add test lost in merge 2020-05-28 21:41:15 -04:00