Commit Graph

25489 Commits

Author SHA1 Message Date
James Bardin f5bf9aa55d make the merge function more precise
This PR implements 2 changes to the merge function.
 - Rather than always defining the merge return type as dynamic, return
 a precise type when all argument types match, or all possible object
 attributes are known.
 - Always return a value containing all keys when the keys are known.
 This allows the use of merge output in for_each, even when keys are yet
 to be determined.
2020-02-05 13:46:08 -05:00
Alisdair McDiarmid dd192e107b
Merge pull request #24038 from hashicorp/alisdair/improve-remote-backend-missing-token-error
Improve remote backend missing token error
2020-02-05 13:44:06 -05:00
Alisdair McDiarmid f15e58adf8 Improve remote backend missing token error
Prompt the user to run terraform login to generate and store a token for
the configured remote backend.
2020-02-05 13:25:29 -05:00
Alisdair McDiarmid e57685d8fc
Merge pull request #24030 from hashicorp/alisdair/terraform-login-token-validation
Add token validation for manual terraform login
2020-02-05 10:07:28 -05:00
Kristin Laemmert 7eed30595a
moduledeps: replace ProviderInstance with addrs.Provider (#24017)
* addrs: add ParseProviderSourceString function to parse fqns from
tfconfig-inspect
* moduledeps: use addrs.Provider instead of ProviderInstance
2020-02-05 09:27:32 -05:00
Alisdair McDiarmid c77cfaafc2 Add token validation for manual terraform login
When a token is pasted by the user, we make a request to the
TFE API /account/details endpoint to verify its validity. If successful,
we display the logged-in username as confirmation. If not, we refuse to
store the invalid token and display an error message.

This commit also trims whitespace from around the pasted value, to
reduce the likelihood of a copy & paste error.
2020-02-04 17:24:25 -05:00
Alisdair McDiarmid e763fd55f3
Update CHANGELOG.md 2020-02-04 12:36:26 -05:00
Kristin Laemmert b371c8523b
Update CHANGELOG.md 2020-02-04 12:10:14 -05:00
Kristin Laemmert 927999a820
command/state show: use configured provider (#24027)
The `state show`  command was not checking if a given resource had a
configured provider, and instead was only using the default provider
config. This PR checks for a configured provider, using the default
provider if one is not set.

Fixes #22010
2020-02-04 12:07:59 -05:00
Martin Atkins 778f1ab138
website: Documentation for the "terraform login" command (#22727)
Co-authored-by: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2020-02-04 11:30:40 -05:00
Alisdair McDiarmid f34cba407f
Merge pull request #23995 from hashicorp/alisdair/terraform-login
Enable login subcommand, add manual token support
2020-02-04 11:28:27 -05:00
Pam Selle c121d1a927
Merge pull request #24021 from hashicorp/codeowners
Update codeowners file with real handles
2020-02-03 17:20:52 -05:00
Pam Selle 64aec0bb51 Remove core ownership, because don't want to default request review on all PRs 2020-02-03 16:48:58 -05:00
Pam Selle a0e6a83931 Update codeowners file with real handles 2020-02-03 16:47:11 -05:00
Kristin Laemmert 80ab551867
terraform: use addrs.Provider as map keys for provider schemas (#24002)
This is a stepping-stone PR for the provider source project. In this PR
"legcay-stype" FQNs are created from the provider name string. Future
work involves encoding the FQN directly in the AbsProviderConfig and
removing the calls to addrs.NewLegacyProvider().
2020-02-03 08:18:04 -05:00
Pam Selle 3e07ae3ff6
Merge pull request #23999 from pselle/for_each_docs
Document for_each key requirements
2020-01-31 16:41:25 -05:00
Martin Atkins 8b511524d6
Initial steps towards AbsProviderConfig/LocalProviderConfig separation (#23978)
* Introduce "Local" terminology for non-absolute provider config addresses

In a future change AbsProviderConfig and LocalProviderConfig are going to
become two entirely distinct types, rather than Abs embedding Local as
written here. This naming change is in preparation for that subsequent
work, which will also include introducing a new "ProviderConfig" type
that is an interface that AbsProviderConfig and LocalProviderConfig both
implement.

This is intended to be largely just a naming change to get started, so
we can deal with all of the messy renaming. However, this did also require
a slight change in modeling where the Resource.DefaultProviderConfig
method has become Resource.DefaultProvider returning a Provider address
directly, because this method doesn't have enough information to construct
a true and accurate LocalProviderConfig -- it would need to refer to the
configuration to know what this module is calling the provider it has
selected.

In order to leave a trail to follow for subsequent work, all of the
changes here are intended to ensure that remaining work will become
obvious via compile-time errors when all of the following changes happen:
- The concept of "legacy" provider addresses is removed from the addrs
  package, including removing addrs.NewLegacyProvider and
  addrs.Provider.LegacyString.
- addrs.AbsProviderConfig stops having addrs.LocalProviderConfig embedded
  in it and has an addrs.Provider and a string alias directly instead.
- The provider-schema-handling parts of Terraform core are updated to
  work with addrs.Provider to identify providers, rather than legacy
  strings.

In particular, there are still several codepaths here making legacy
provider address assumptions (in order to limit the scope of this change)
but I've made sure each one is doing something that relies on at least
one of the above changes not having been made yet.

* addrs: ProviderConfig interface

In a (very) few special situations in the main "terraform" package we need
to make runtime decisions about whether a provider config is absolute
or local.

We currently do that by exploiting the fact that AbsProviderConfig has
LocalProviderConfig nested inside of it and so in the local case we can
just ignore the wrapping AbsProviderConfig and use the embedded value.

In a future change we'll be moving away from that embedding and making
these two types distinct in order to represent that mapping between them
requires consulting a lookup table in the configuration, and so here we
introduce a new interface type ProviderConfig that can represent either
AbsProviderConfig or LocalProviderConfig decided dynamically at runtime.

This also includes the Config.ResolveAbsProviderAddr method that will
eventually be responsible for that local-to-absolute translation, so
that callers with access to the configuration can normalize to an
addrs.AbsProviderConfig given a non-nil addrs.ProviderConfig. That's
currently unused because existing callers are still relying on the
simplistic structural transform, but we'll switch them over in a later
commit.

* rename LocalType to LocalName

Co-authored-by: Kristin Laemmert <mildwonkey@users.noreply.github.com>
2020-01-31 08:23:07 -05:00
Pam Selle 4e0879c486 Document for_each key requirements 2020-01-30 17:18:16 -05:00
Alisdair McDiarmid b75201acc2 Enable login subcommand, add manual token support 2020-01-30 09:55:38 -05:00
Chris Griggs 93e29b71a4
Merge pull request #23974 from hashicorp/cgriggs01-auth0-links
[Website] Add Auth0 provider links
2020-01-28 14:47:39 -08:00
Chris Griggs 489bd2b84e [Website] Add Auth0 provider links 2020-01-28 14:14:01 -08:00
Chris Griggs 52a4a79ba2
Merge pull request #23971 from hashicorp/cgriggs01-docs-update
[Website] Verified module update
2020-01-28 11:24:16 -08:00
Chris Griggs 26d8092f03 [Website] Verified module update 2020-01-28 10:51:40 -08:00
Chris Griggs 7bc049c59f
Merge pull request #23968 from hashicorp/cgriggs01-incapsula
Cgriggs01 incapsula
2020-01-28 10:01:53 -08:00
Chris Griggs 2ba36d7d93 fix 2020-01-28 09:06:15 -08:00
Chris Griggs 3c8a61d4cb [Website] add incapsula links 2020-01-28 09:00:42 -08:00
Kristin Laemmert 6541775ce4
addrs: roll back change to Type field in ProviderConfig (#23937) 2020-01-28 08:13:30 -05:00
Martin Atkins e9d0822b2a command: Accept a "provider source" from the main package
Following the same approach we use for other CLI-Config-able objects like
the service discovery system, the main package is responsible for
producing a suitable implementation of this interface which the command
package can then use.

When unit testing in the command package we can then substitute mocks as
necessary, following the dependency inversion principle.
2020-01-24 13:45:37 -08:00
Pam Selle 2672ddba02
Merge pull request #23949 from hashicorp/docs/dynamic-blocks
Update dynamic block docs to use a better example
2020-01-24 14:42:27 -05:00
Pam Selle 213189c3d0 Use a real resource 2020-01-24 13:47:51 -05:00
Pam Selle 885ff69c50 Update docs to generalize/use fake example vs one that could be misleading 2020-01-24 12:44:07 -05:00
Chris Griggs b1313eaf7d
Merge pull request #23935 from hashicorp/cgriggs01-community-links
[Website] Adding two new community providers
2020-01-23 10:34:53 -08:00
Chris Griggs 2b3b2781f2 Adding two new community providers 2020-01-23 10:27:51 -08:00
tf-release-bot 9670cd37df Cleanup after v0.12.20 release 2020-01-22 22:08:22 +00:00
tf-release-bot d12152f730
v0.12.20 2020-01-22 21:51:40 +00:00
Pam Selle 28b43a7a4e
Update CHANGELOG.md 2020-01-22 15:12:17 -05:00
Pam Selle 9f374eb1fc
Merge pull request #23865 from loslocostacos/fix-win-tfe-pathing
Fix compatibility issue between Windows CLI and remote plan and apply
2020-01-22 12:04:41 -05:00
Martin Atkins 4d7122a0dd internal/getproviders: LookupLegacyProvider
This is a temporary helper so that we can potentially ship the new
provider installer without making a breaking change by relying on the
old default namespace lookup API on the default registry to find a proper
FQN for a legacy provider provider address during installation.

If it's given a non-legacy provider address then it just returns the given
address verbatim, so any codepath using it will also correctly handle
explicit full provider addresses. This also means it will automatically
self-disable once we stop using addrs.NewLegacyProvider in the config
loader, because there will therefore no longer be any legacy provider
addresses in the config to resolve. (They'll be "default" provider
addresses instead, assumed to be under registry.terraform.io/hashicorp/* )

It's not decided yet whether we will actually introduce the new provider
in a minor release, but even if we don't this API function will likely be
useful for a hypothetical automatic upgrade tool to introduce explicit
full provider addresses into existing modules that currently rely on
the equivalent to this lookup in the current provider installer.

This is dead code for now, but my intent is that it would either be called
as part of new provider installation to produce an address suitable to
pass to Source.AvailableVersions, or it would be called from the
aforementioned hypothetical upgrade tool.

Whatever happens, these functions can be removed no later than one whole
major release after the new provider installer is introduced, when
everyone's had the opportunity to update their legacy unqualified
addresses.
2020-01-22 09:02:22 -08:00
Chris Griggs 35acaf8a85
Merge pull request #23922 from hashicorp/cgriggs01-metalcloud
[Website] Add MetalCloud provider links
2020-01-22 08:54:17 -08:00
Chris Griggs be2dcb4a32
Merge pull request #23923 from hashicorp/cgriggs01-stable-metal
[Cherry-pick]
2020-01-22 08:54:06 -08:00
Chris Griggs 38afbb34c6 [Website] Add MetalCloud provider links 2020-01-22 08:44:00 -08:00
Chris Griggs efa71f8aa7 [Website] Add MetalCloud provider links 2020-01-22 08:42:19 -08:00
Avi Zurel 96645d7ea7 website: Better example for running 0.12upgrade across many directories at once 2020-01-21 18:28:06 -08:00
Chris Griggs b8d720f834
Merge pull request #23916 from hashicorp/cgriggs01-stable
[Cherrypick] community links
2020-01-21 17:45:48 -08:00
Chris Griggs 8acab32c42
Merge pull request #23915 from hashicorp/cgriggs01-community-additions
[Website] Updating community provider listings
2020-01-21 17:45:43 -08:00
Chris Griggs 9ea88f22fc add/update community provider listings 2020-01-21 17:12:05 -08:00
Chris Griggs 2010ce2804 add/update community provider listings 2020-01-21 17:08:06 -08:00
Steve Burns 26305a83a3 Remove unecessary conditions for module manifest read and write functions 2020-01-17 12:14:17 -07:00
Daniel Dreier 05c9407986
Merge pull request #23293 from kmfk/hide-values-undeclared-var-warning
Avoid leaking sensitive values in undeclared variable warnings
2020-01-15 16:08:19 -08:00
James Bardin 94b1792b99
Merge pull request #23862 from hashicorp/jbardin/destroy-prov-path
it's safe for destroy provisioners to access path
2020-01-15 16:59:34 -05:00