Commit Graph

26536 Commits

Author SHA1 Message Date
Justin Campbell e85376990d
website: Terraform Registry Provider Publishing docs (#25378)
* website: Terraform Registry Provider Publishing

* website: (Registry) remove OS/arch recommendation

Until we have a canonical list to point to

Co-authored-by: Paul Tyng <ptyng@hashicorp.com>

Co-authored-by: Paul Tyng <ptyng@hashicorp.com>
2020-06-29 11:04:52 -04:00
Alisdair McDiarmid ac99a3b916 terraform: Relax provider config ref constraints
When configuring providers, it is normally valid to refer to any value
which is known at apply time. This can include resource instance
attributes, variables, locals, and so on.

The import command has a simpler graph evaluation, which means that
many of these values are unknown. We previously prevented this from
happening by restricting provider configuration references to input
variables (#22862), but this was more restrictive than is necessary.

This commit changes how we verify provider configuration for import.
We no longer inspect the configuration references during graph building,
because this is too early to determine if these values will become known
or not.

Instead, when the provider is configured during evaluation, we
check if the configuration value is wholly known. If not, we fail with a
diagnostic error.

Includes a test case which verifies that providers can now be configured
using locals as well as vars, and an updated test case which verifies
that providers cannot be configured with references to resources.
2020-06-29 10:58:20 -04:00
Kristin Laemmert 45d72b3018
terraform: check for unknows in for_each type before validating set (#25426)
element types

The error message when evaluateForEachExpression encounted an unknown
value of cty.DynamicPseudoType was not clear:

The given "for_each" argument value is unsuitable: "for_each" supports maps
and sets of strings, but you have provided a set containing type dynamic.

By moving the check for unknowns before the check for set element types,
the following error is returned instead:

"The "for_each" value depends on resource attributes that cannot be
determined until apply (...)"
2020-06-29 09:12:36 -04:00
James Bardin 6243a6307a don't evaluate destroy instances
Orphaned instances that are create_before_destroy will still be in the
state when their references are evaluated. We need to skip instances
that are planned to be destroyed altogether, as they can't be part of an
evaluation.
2020-06-26 18:05:53 -04:00
Kristin Laemmert be34a0e76f
Update CHANGELOG.md 2020-06-26 12:50:10 -04:00
Kristin Laemmert df244b87c2
command/init: return an error with invalid -backend-config files (#25411)
* command/init: return an error with invalid -backend-config files

The -backend-config flag expects a set of key-value pairs or a file
containing key-value pairs. If the file instead contains a full backend
configuration block, it was silently ignored. This commit adds a check
for blocks in the file and returns an error if they are encountered.

Fixes #24845

* emphasize backend configuration file in docs
2020-06-26 12:49:31 -04:00
Julian Grinblat 0b3c0f64c2
build: Allow building on non-terraform named directory (#25340)
* Allow building on non-terraform named directory

* Fix gofmt errors

* Fix generate-plugins.go unused variable error
2020-06-26 12:07:58 -04:00
DouglasFarr 81b83763e9
website/docs: Typo fix to v11 upgrade guide (#25357)
with* correction.
2020-06-26 11:38:11 -04:00
Alisdair McDiarmid 65ddf2c664
Update CHANGELOG.md 2020-06-26 10:00:48 -04:00
Alisdair McDiarmid 7190ef571e
Merge pull request #25408 from hashicorp/alisdair/fix-panic-provider-alias
configs: Fail early for invalid resource provider
2020-06-26 09:59:46 -04:00
Alisdair McDiarmid 5e3d2dbdfa configs: Fail early for invalid resource provider
If a resource's "provider" reference is invalid and cannot be parsed, we
should not store the reference as part of a `ProviderConfigRef`. Doing
so creates an invalid data structure, which prevents us from using
`MustParseProviderPart` with the name in later steps.

The invalid test files added in this commit will cause a panic without
the code change.
2020-06-26 09:47:58 -04:00
Paul Tyng 4459e6ea3a
Merge pull request #25385 from hashicorp/newrelic
Fix links to migrated providers
2020-06-26 08:57:51 -04:00
Alisdair McDiarmid 5b9ae35e67
Update CHANGELOG.md 2020-06-26 08:57:46 -04:00
Alisdair McDiarmid fef43ad5b7
Merge pull request #25400 from hashicorp/alisdair/update-cty
Upgrade go-cty to v1.5.1
2020-06-26 08:56:15 -04:00
James Bardin 32d12d9719
Merge pull request #25373 from hashicorp/jbardin/targeting
New target transformer
2020-06-25 20:58:34 -04:00
Alisdair McDiarmid cc655af72f go get github.com/zclconf/go-cty@v1.5.1 2020-06-25 17:05:19 -04:00
Petros Kolyvas 16989dc70c
Merge pull request #25394 from Mikulas/patch-1
Document swift support for locks
2020-06-25 16:37:17 -04:00
James Bardin c96914d624
Merge pull request #25399 from hashicorp/jbardin/destroy-deps
index destroy dependencies by addrs.ConfigResource
2020-06-25 16:04:03 -04:00
James Bardin 9f7b3cc1dc index destroy dependencies by addrs.ConfigResource
When the DestroyEdgeTransformer was updated to handle stored
dependencies the addrs.ConfigResource type did not yet exist. The lookup
map keys in the transformer needed to be updated to remove module
indexes.
2020-06-25 15:28:39 -04:00
Martin Atkins f131f182d4
Update 0-13.html.markdown 2020-06-25 10:17:16 -07:00
Alisdair McDiarmid 0331f7627d
Update CHANGELOG.md, moving some misplaced items
I have been adding recent bug fixes to the wrong section of the changelog. This commit
moves them to the UNRELEASED section.
2020-06-25 13:04:02 -04:00
Alisdair McDiarmid b4cc77b6cd
Merge pull request #25379 from hashicorp/alisdair/yes
command/login: Require "yes" to confirm
2020-06-25 13:00:02 -04:00
Alisdair McDiarmid f6f707c669
Merge pull request #25381 from hashicorp/alisdair/013upgrade-preserves-more-comments
command: Fix 0.13upgrade to preserve more comments
2020-06-25 12:56:34 -04:00
Martin Atkins 02b130cd59 website: Terraform v0.13 upgrade guide 2020-06-25 09:24:41 -07:00
Chris Griggs b4bfbfdc07
Merge pull request #25392 from hashicorp/cgriggs01-rubrik
[Website] Add Rubrik links
2020-06-25 09:05:17 -07:00
Mikuláš Dítě 491733bb8e
Document swift support for locks
Introduced in https://github.com/hashicorp/terraform/pull/20211
2020-06-25 17:56:10 +02:00
Alisdair McDiarmid 779fe37a1c command/login: Require "yes" to confirm
This is for consistency with other commands which use prompts, all of
which require "yes" rather than "y" to confirm.

We also migrate the login command to use UIInput, which now supports
securely asking for passwords or secrets via the speakeasy library.
2020-06-25 11:46:51 -04:00
Chris Griggs 233a75d747 [Website] Add Rubrik links 2020-06-25 08:28:18 -07:00
Kristin Laemmert 47e657c611
internal/getproviders: decode and return any registry warnings (#25337)
* internal/getproviders: decode and return any registry warnings

The public registry may include a list of warnings in the "versions"
response for any given provider. This PR adds support for warnings from
the registry and an installer event to return those warnings to the
user.
2020-06-25 10:49:48 -04:00
James Bardin 98ff2065bc
Merge pull request #25377 from hashicorp/jbardin/remote-state
Correct remote state return value
2020-06-25 10:43:22 -04:00
Kristin Laemmert 2d0b312ea8
Update CHANGELOG.md 2020-06-25 08:42:34 -04:00
Kristin Laemmert d4ec69cfb3
communicator/winrm: include configured timeout in winrm server
* upgrade windows dependencies
* communicator/winrm: include configured timeout in winrm server
2020-06-25 08:41:09 -04:00
Tom Harvey 2564203312
updating to include #24069 2020-06-25 11:50:55 +02:00
Even Holthe 0f85b283b9
Azure backend: support snapshots/versioning (#24069)
* Azure backend: support snapshots/versioning

Co-authored-by: Reda Ahdjoudj <reda.ahdjoudj@gmail.com>
Co-authored-by: Patrick F. Marques <patrickfmarques@gmail.com>

* Azure backend: Versioning -> Snapshot

Co-authored-by: Reda Ahdjoudj <reda.ahdjoudj@gmail.com>
Co-authored-by: Patrick F. Marques <patrickfmarques@gmail.com>
2020-06-25 11:50:16 +02:00
Paul Tyng 4a7fc14a68 Fix links to migrated providers 2020-06-24 21:46:58 -04:00
Martin Atkins f1ea705dbe website: Restore the docs for "terraform 0.12upgrade"
Although this command is removed in Terraform 0.13, our documentation is
for all versions of Terraform that remain in common use and keeping this
documented will be helpful for folks who are still using Terraform 0.11
and planning their upgrades to Terraform 0.12.

Both of the upgrade commands now include notes that they are only
available in their specific major version, along with a link to the
relevant upgrade guide for other background information about the upgrade,
in case the user finds the command documentation first. (The command docs
are, I think, a little more discoverable than the upgrade guides.)
2020-06-24 14:21:09 -07:00
Alisdair McDiarmid b6739829e7 command: Fix 0.13upgrade to preserve more comments
Previously, any comments inside the required provider configuration for
a given provider would be wiped out upon rerunning the 0.13upgrade
command. This commit attempts to preserve those comments if the existing
entry is semantically equivalent to the entry we are about to write.
2020-06-24 15:54:46 -04:00
James Bardin 731b19ab46 e2e test for remote state read 2020-06-24 14:09:59 -04:00
Pam Selle ad8ff621ff
Update CHANGELOG.md 2020-06-24 14:05:49 -04:00
João G. Packer fd47260fdc
command: adjust exit code of state rm (#22300)
* command: adjust exit code of state rm and state mv

Commands `state rm` and `state mv` will now exit with code 1 when the
target resource is not found in the current state.
This is consistent with `terraform state show non_existent_resource`.

Fixes #17800
2020-06-24 14:03:23 -04:00
James Bardin a0fad2c6b4 always return original workspace, even when null
The returned value type needs to strictly match the proposed value type.
2020-06-24 13:41:51 -04:00
Alisdair McDiarmid 9f455bfc55
Update CHANGELOG.md 2020-06-24 13:39:56 -04:00
Alisdair McDiarmid 563abd55dc
Merge pull request #25369 from hashicorp/alisdair/fix-provider-requirements-panics
configs: Fix provider requirements panics
2020-06-24 13:38:11 -04:00
Alisdair McDiarmid f714a9da79
Merge pull request #25352 from hashicorp/alisdair/fix-import-allow-missing-config
command/import: Fix allow-missing-config option
2020-06-24 13:37:13 -04:00
James Bardin 6ef11e9d9e update CHANGELOG.md 2020-06-24 13:35:21 -04:00
James Bardin f9ff7d1ee8 test for targeting with modules and output 2020-06-24 12:52:29 -04:00
Martin Atkins 8f77bd344e lang/funcs: Filesystem functions hint about dynamically-generated files
The functions that interact with the filesystem are, by design, restricted
to reading files that are distributed as a static part of the
configuration, and cannot be used to interact with files that are
generated dynamically by resources in the configuration.

However, new users have often yet developed a correct mental model of how
Terraform execution works and are confused by the terse error messages
these functions return. As an interim step to help some of those users,
this just adds some more commentary to the error message which gives a
vague, generic directive to look to attributes of the resource that is
generating the file, which should (if it's designed well) export
attributes that allow the resulting file to be used effectively with
common patterns, such as checksums of the content of the generated file.

The error message here is not particularly attractive due to the
limitations of the context where it's being returned from, but I'm
accepting that here in the interest of keeping this change simple, so we
can give a hint about a case that seems to frequently generate new-user
questions. We may iterate further on the presentation of this message
later.
2020-06-24 09:02:38 -07:00
Alisdair McDiarmid 8c3648c1e6
terraform version is preferred 2020-06-24 10:59:59 -04:00
Alisdair McDiarmid 7b526b1969
terraform version is preferred 2020-06-24 10:59:49 -04:00
James Bardin 2fa16c24f7 remove unused interfaces
RemovableIfNotTargeted and GraphNodeTargetDownstream are no longer used
by the target transformer.
2020-06-24 10:45:58 -04:00