Commit Graph

27327 Commits

Author SHA1 Message Date
Alisdair McDiarmid 45671a354d configs: Fix provider lookup local name mismatch
When a resource has no `provider` argument specified, its provider is
derived from the implied provider type based on the resource type. For
example, a `boop_instance` resource has an implied provider local name
of `boop`. Correspondingly, its provider configuration is specified with
a `provider "boop"` block.

However, users can use the `required_providers` configuration to give a
different local name to a given provider than its defined type. For
example, a provider may be published at `foobar/beep`, but provide
resources such as `boop_instance`. The most convenient way to use this
provider is with a `required_providers` map:

terraform {
  required_providers {
    boop = {
      source = "foobar/beep"
    }
  }
}

Once that local name is defined, it is used for provider configuration
(a `provider "boop"` block, not `provider "beep"`). It should also be
used when looking up a resource's provider configuration or provider.

This commit fixes a bug with this edge case, where previously we were
looking up the local provider configuration block using the resource's
assigned provider type. Instead, if no provider argument is specified,
we should be using the implied provider type, as that is what binds the
resource to the local provider configuration.
2020-11-10 15:25:02 -05:00
Justin Campbell 7c98be92c2
website: Add Registry docs for webhooks (#26870) 2020-11-10 12:33:26 -05:00
Robin Norwood ec7d9c85ac Update link to new varibles tutorial 2020-11-09 11:52:28 -08:00
James Bardin 5a2253e653
Merge pull request #26848 from hashicorp/jbardin/deps
update go-plugin and go-hclog
2020-11-09 08:31:14 -05:00
Radek Simko d011d0d507
Merge pull request #26836 from hashicorp/terraform-provider-descriptions
builtin/provider/terraform: Add field descriptions
2020-11-07 10:33:41 +00:00
James Bardin 5f76460294 update go-plugin and go-hclog 2020-11-06 16:38:26 -05:00
Alisdair McDiarmid 2d301f1fb3
Update CHANGELOG.md 2020-11-06 16:37:41 -05:00
Upo 3b9c5e5bbb
backend/gcs: remove deprecated "path" config argument (#26841) 2020-11-06 16:35:40 -05:00
Alisdair McDiarmid 4b58d62c54
Merge pull request #26844 from hashicorp/alisdair/update-output-command-docs
website: Update output command docs
2020-11-06 16:30:03 -05:00
Alisdair McDiarmid 3680bc521a website: Update output command docs
The example configuration now uses Terraform 0.12+ syntax, and the
output examples are up to date with the current text UI. We also add an
explicit recommendation to use the `-json` option for a consistent and
stable output format, for use in automation.
2020-11-06 15:10:31 -05:00
Alisdair McDiarmid 60e01f595c
Merge pull request #26761 from hashicorp/alisdair/compare-locks-and-provider-requirements
terraform: Compare locks and provider requirements
2020-11-06 13:12:26 -05:00
Alisdair McDiarmid 10cc25fc21 terraform: Compare locks and provider requirements
When building a context, we read the dependency locks and ensure that
the provider requirements from the configuration can be satisfied.
If the configured requirements change such that the locks need to be
updated, we explain this and recommend running "terraform init".

This check is ignored for any providers which are locally marked as in
development. This includes unmanaged providers and those listed in the
provider installation `dev_overrides` block.
2020-11-06 12:58:52 -05:00
Pam Selle e38e8e2e61
Merge pull request #26832 from hashicorp/pselle/validate-sensitive-output
Mark variables as sensitive (if relevant) in validate
2020-11-06 10:24:16 -05:00
Upo 4ccc63d79d
backend: Add service account impersonation to GCS Backend and update the docs (#26700) 2020-11-06 09:06:07 -05:00
Joshua Mendoza 27e31e1160
Update lookup.html.md (#26835)
Typo in introductory paragraph.
2020-11-06 09:58:33 -04:00
Radek Simko bc87be384b
builtin/provider/terraform: Add field descriptions 2020-11-06 08:51:07 +00:00
Pam Selle fd52bf21e8 Mark variables as sensitive (if relevant) in validate
Ensure that variables are marked in the validate walk
so that appropriate diags will surface at validate
rather than surprising users at apply
2020-11-05 16:09:10 -05:00
Pam Selle 61c4e49b11
Merge pull request #26827 from hashicorp/pselle/cty-mod
Update zclconf/go-cty dependency
2020-11-05 14:18:22 -05:00
Pam Selle 5ed4af0290 Update zclconf/go-cty dependency 2020-11-05 11:46:36 -05:00
James Bardin 1d6fdff999
Merge pull request #26826 from hashicorp/jbardin/plugin-crash-filter
hide provider crashes from panicwrap when logging
2020-11-05 11:04:24 -05:00
James Bardin d52e17e111 hide provider crashes from panicwrap when logging
When logging is turned on, panicwrap will still see provider crashes and
falsely report them as core crashes, hiding the formatted provider
error. We can trick panicwrap by slightly obfuscating the error line.
2020-11-05 10:54:21 -05:00
James Bardin cb541be377
Merge pull request #26810 from hashicorp/jbardin/validate-ignore-changes
Allow null attributes to be referenced in ignore_changes
2020-11-05 08:29:26 -05:00
Martin Atkins 7e212cd02f
Update CHANGELOG.md 2020-11-04 17:07:53 -08:00
Martin Atkins ae3c0c6a4a lang/funcs: Remove the deprecated "list" and "map" functions
Prior to Terraform 0.12 these two functions were the only way to construct
literal lists and maps (respectively) in HIL expressions. Terraform 0.12,
by switching to HCL 2, introduced first-class syntax for constructing
tuple and object values, which can then be converted into list and map
values using the tolist and tomap type conversion functions.

We marked both of these functions as deprecated in the Terraform v0.12
release and have since then mentioned in the docs that they will be
removed in a future Terraform version. The "terraform 0.12upgrade" tool
from Terraform v0.12 also included a rule to automatically rewrite uses
of these functions into equivalent new syntax.

The main motivation for removing these now is just to get this change made
prior to Terraform 1.0. as we'll be doing with various other deprecations.
However, a specific reason for these two functions in particular is that
their existence is what caused us to invent the idea of a "type expression"
as a distinct kind of expression in Terraform v0.12, and so removing them
now would allow potentially  unifying type expressions with value
expressions in a future release.

We do not have any current specific plans to make that change, but one
potential motivation for doing so would be to take another attempt at a
generalized "convert" function which takes a type as one of its arguments.
Our previous attempt to implement such a function was foiled by the fact
that Terraform's expression validator doesn't have any way to know to
treat one argument of a particular function as special, and so it was
generating incorrect error messages. We won't necessarily do that, but
having these "list" and "map" functions out of the way leaves the option
open.
2020-11-04 17:05:59 -08:00
James Bardin c5b4ccfe8c
Merge pull request #26816 from hashicorp/jbardin/provider-config
Validate final provider configuration
2020-11-04 16:57:02 -05:00
James Bardin 99db18388a return diagnostics from resource validation
Return diagnostics rather than an error, since the EvalNodes have been
removed and the caller has been updated.

IgnoreWarnings was no longer used.
2020-11-04 16:56:17 -05:00
James Bardin 73680546a8 udpate PrepareProviderConfig docs
Indicate that the PreparedConfig is not used by core.
2020-11-04 13:02:04 -05:00
James Bardin e7b2d98ca3 Use prepared config in provider.Configure
Core is only using the PrepareProviderConfig call for the validation
part of the method, but we should be re-validating the final config
immediately before Configure.

This change elects to not start using the PreparedConfig here, since
there is no useful reason for it at this point, and it would
introduce a functional difference between terraform releases that can be
avoided.
2020-11-04 12:53:00 -05:00
James Bardin 96b099cf35 allow nil config attributes in ignore_changes
The validation for ignore_changes was too broad, and makes it difficult
to ignore changes in an attribute that the user does not want to set.
While the goal of ignore_changes is to prevent changes in the
configuration alone, we don't intend to break the use-case of ignoring
drift from the provider. Since we cannot easily narrow the validation to
only detect computed attributes at the moment, we can drop this error
altogether for now.
2020-11-04 11:03:12 -05:00
Alisdair McDiarmid fd43bc7847
Merge pull request #26783 from hashicorp/alisdair/normalize-version-constraints-before-deduplication
getproviders: Normalize versions before dedupe
2020-11-04 09:42:19 -05:00
Alisdair McDiarmid 4da3e01b82
Merge pull request #26762 from hashicorp/alisdair/upgrade-go-getter
Upgrade go-getter to v1.5.0
2020-11-04 09:11:57 -05:00
Radek Simko eddcc4d80c
docs: Fix typo (provider arg in data source) (#26802) 2020-11-04 09:55:15 -04:00
Jacob Tomaw 3f9abbc30d
Remove redundant Local Named Values section
The second Local Named Values has a subset of the information the first one has and adds nothing to the documentation other than confusion.
2020-11-03 08:09:12 -05:00
James Bardin 6bb79b7714
Merge pull request #26788 from hashicorp/jbardin/eval-self-block
allow path and terraform in self-block eval
2020-11-02 15:09:39 -05:00
Tej-Singh-Rana 832918c65b
website: fixed spelling error (#26758) 2020-11-02 11:15:44 -08:00
timvandamme fbf267fbfd
website: for_each doesn't implicitly convert to set (#26450)
The documentation states that an explicit type conversion to set is needed, but it does not say why implicit type conversion does not work. 

Co-authored-by: Nick Fagerlund <nick@hashicorp.com>
2020-11-02 11:13:51 -08:00
James Bardin 7c4d00c04c allow path and terraform in self-block eval
We can insert the terraform and path values into EvalSelfBlock, since
these are static and always known during evaluation.
2020-11-02 14:00:58 -05:00
Alisdair McDiarmid 90c4f11b61 go get github.com/hashicorp/go-getter@v1.5.0
Includes fix for breaking upstream API change.
2020-11-02 10:46:24 -05:00
Alisdair McDiarmid b1bc0e5d92 getproviders: Normalize versions before dedupe
When rendering a set of version constraints to a string, we normalize
partially-constrained versions. This means converting a version
like 2.68.* to 2.68.0.

Prior to this commit, this normalization was done after deduplication.
This could result in a version constraints string with duplicate
entries, if multiple partially-constrained versions are equivalent. This
commit fixes this by normalizing before deduplicating and sorting.
2020-11-02 10:45:45 -05:00
Alisdair McDiarmid 3ed08e3566 Remove backport review teams for now
This requires more GitHub token permissions than we have, and it's
inessential. The backport PRs should have reviews assigned to the
original PR author anyway.
2020-11-02 10:43:22 -05:00
Alisdair McDiarmid 7ec85a7588
Merge pull request #26784 from hashicorp/alisdair/only-show-root-module-output-changes
backend: Only show root module output changes
2020-11-02 10:34:59 -05:00
Alisdair McDiarmid b335918c3c backend: Only show root module output changes
When rendering planned output changes, we need to filter the plan's
output changes to ensure that only root module outputs which have
changed are rendered. Otherwise we will render changes for submodule
outputs, and (with concise diff disabled) render unchanged outputs also.
2020-11-02 10:24:22 -05:00
Radek Simko a413fa7425
Merge pull request #26763 from hashicorp/radeksimko-patch-1
docs: fix typo in provider local name
2020-10-31 08:37:33 +00:00
tuathail 33ee8a410c
website: Add note re: private_key configuration to intro (#24463) 2020-10-30 18:09:21 -07:00
Repon Kumar Roy 34549b402b website: clarify version constraint syntax 2020-10-30 17:44:48 -07:00
Nick Fagerlund a058b64eb5
website: Index for `element` must be a non-negative integer (#26679)
* The index must be non-negative integer

and added instructions on how to get the last value in the list.

* Typo fix

Co-authored-by: Nick Fagerlund <nick@hashicorp.com>
2020-10-30 17:43:35 -07:00
Nick Fagerlund 5a4957f141
Typo fix 2020-10-30 17:42:40 -07:00
Nick Fagerlund a0fee4c380 website: one more provider name typo 2020-10-30 17:35:23 -07:00
Radek Simko 8476c3f13e
docs: fix typo in provider local name 2020-10-30 21:59:19 +00:00
Alvin Huang 70a8be60b9 switch to hashicorp docker mirror 2020-10-29 22:37:11 -04:00