Commit Graph

20556 Commits

Author SHA1 Message Date
Martin Atkins 74180229d0 svchost/disco: allow overriding discovery for a particular hostname
The default network-based discovery is not desirable for all situations,
so this mechanism allows callers to provide a services map for a given
hostname that was obtained some other way (caller-defined) which will then
cause network-based discovery to be skipped and the given map to be
returned verbatim.
2017-10-26 08:58:52 -07:00
Radek Simko ddff8bbc00 Update CHANGELOG.md 2017-10-26 15:57:19 +01:00
Radek Simko c57ed954d3 Merge pull request #16456 from hashicorp/f-loosen-schema-validation
helper/schema: Loosen validation for 'id' field
2017-10-26 15:56:24 +01:00
Radek Simko 7fceccfbf7
helper/schema: Loosen validation for 'id' field 2017-10-26 09:37:38 +01:00
Martin Atkins dfaa21fcf2 Update CHANGELOG.md 2017-10-25 17:38:30 -07:00
Martin Atkins 9f6b33139e Update CHANGELOG.md 2017-10-25 17:38:00 -07:00
Martin Atkins 5347f82f9a command: Include provider versions in "terraform version"
We encourage users to share the "terraform version" output as part of
filing an issue, but previously it only printed the core Terraform version
and this left provider maintainers with no information about which
_provider_ version an issue relates to.

Here we make a best effort to show versions for providers, though we will
omit some or all of them if either "terraform init" hasn't been run (and
so no providers were selected yet) or if there are other inconsistencies
that would cause Terraform to object on startup and require a re-run of
"terraform init".
2017-10-25 17:36:24 -07:00
Martin Atkins 34cecfa839 command/e2etest: fix incorrect "terraform version" test
Two different errors here caused this test to pass even though it was
incorrect: the wanted version string was incorrect, but the test for it
was also inverted, and so together this made the test pass even though
it was actually not testing the output at all.
2017-10-25 17:36:24 -07:00
James Bardin d33e0f0a58 Merge pull request #16452 from hashicorp/jbardin/registry-packages
Registry packages
2017-10-25 17:19:07 -04:00
James Bardin 0a673fa5ef use svchost.IsValid for FriendlyHost.Valid 2017-10-25 17:10:15 -04:00
James Bardin 54c5aab7ef missed another models dep in the registry 2017-10-25 15:57:51 -04:00
James Bardin a881460839 fix vet error in registry package 2017-10-25 15:49:35 -04:00
James Bardin 4f76d3a556 remove models dependency from the regresp
That isn't needed by terraform, and can be left in a registry package.
2017-10-25 15:27:29 -04:00
James Bardin 666164c369 disallow github and bitbucket hosts
These hosts have special usage in module source strings, and can't be
valid registry hosts.
2017-10-25 14:11:34 -04:00
James Bardin 27e578e7fb convert FriendlyHost to use svchost for validation
Removed some of the test cases that we don't allow in the svchost
package. Will check back if those are needed in the registry and work
around them as necessary.
2017-10-25 14:11:34 -04:00
James Bardin 248a5e4523 copy regsrc and response from registry repo
keep these in one place for now
2017-10-25 14:11:33 -04:00
Martin Atkins 12b6ec9241 release: clean up after v0.10.8 2017-10-25 09:17:09 -07:00
Martin Atkins e0fd3ddd70
v0.10.8 2017-10-25 09:13:40 -07:00
James Bardin f9ad58c66a Merge pull request #16451 from hashicorp/jbardin/disco
add Transport field to Disco
2017-10-25 12:04:07 -04:00
James Bardin e7ecec6860 add Transport field to Disco
For the same reason the disco tests need to override the http.Transport,
other test fixtures will need to as well. Provide a field to override
the default httpTransport.
2017-10-25 10:49:36 -04:00
JJ Asghar 5ae892fdf2 provisioner/chef: doc example of ssl_verify_mode 2017-10-24 14:47:42 -07:00
Clint 385e564250 fix build ld_flag (#16430) 2017-10-24 14:10:15 -05:00
Lyle Franklin 43dcaa1a00 config: Don't panic if config directory contains only overrides 2017-10-23 15:46:15 -07:00
Martin Atkins 8d9b44105a Update CHANGELOG.md 2017-10-23 13:30:40 -07:00
jd3nn1s 21c9c2ce00 communicator/winrm: pass cacert option correctly
It appears that the cacert option for the winrm provisioner was
not getting passed correctly to the winrm package. Log output
showed that CACert was false regardless of configuration.

While the validation of the connector looked for cacert, the winrm
communicator looked for ca_cert.
2017-10-23 13:28:41 -07:00
Martin Atkins 1feb26f196 main: load CLI config files from ~/.terraform.d/*.tfrc
Now that we are looking into the CLI config file for service host
credentials, it's important to support multiple separate files so that
users can keep credentials separate from other settings and credentials
for different hosts separate from one another.

There is no restriction on which settings can appear in which locations.
This is up to the user to decide, depending on their security needs and
e.g. on whether certain files are generated vs. manually-edited.
2017-10-21 09:37:05 -07:00
Martin Atkins 11ba1d2a4c main: factor out CLI config loading into its own function
Previously we handled all of the config sources directly within the main
function. We're going to make CLI config loading more complex shortly, so
having this encapsulated in its own function will avoid creating even more
clutter inside the main function.

Along the way here we also switch from using native Go "error" to using
tfdiags.Diagnostics, so that we can potentially issue warnings here too
in future, and so that we can return multiple errors.
2017-10-21 09:37:05 -07:00
Martin Atkins a2c59c6ecd main: validate credentials blocks in CLI config
We require that each "credentials" block has a valid hostname and that
there be no more than one "credentials_helper" block.

There are some more sophisticated validations we could do here, such as
checking if the same host is declared more than once, but since this
config handling will be rewritten to use HCL2 in the near future, and this
sort of check is easier to do in the HCL2 API, we just check the basic
stuff for now and plan to revisit later.
2017-10-21 09:37:05 -07:00
Martin Atkins fe7ef7ae5d main: include credentials and credentials_helper when merging CLI configs 2017-10-21 09:37:05 -07:00
Martin Atkins 35a058fb3d main: configure credentials from the CLI config file 2017-10-21 09:37:05 -07:00
James Bardin 47c45788bc Merge pull request #16406 from hashicorp/jbardin/version-package
Add a standalone version package for all of terraform
2017-10-20 21:53:42 -04:00
Martin Atkins 374bafab33 Update CHANGELOG.md 2017-10-20 15:43:56 -07:00
Patrick Van Stee a4a53f6f99 command/validate: Load plugins from plugin_path file
This was added to other commands in 0.10 but was missed on "validate".
2017-10-20 15:42:51 -07:00
Arthur Burkart 013df9350b hashcode: "Strings" function for hashing slices of strings 2017-10-20 14:54:23 -07:00
Sander van Harmelen 314ef8b110 Update CHANGELOG.md 2017-10-20 17:50:37 +02:00
Sander van Harmelen a5d7f94ced Update CHANGELOG.md 2017-10-20 17:49:57 +02:00
Christoph Kappel af206e7543 Clean clients from chef-vault on recreate_client enabled (#16357)
Fixes #15921

When terraform re-creates an existing node/client with chef provisioner,
the already existing client (which has old keys) must be removed from
the vault items. Afterwards, the chef-vault will be updated with the
newly created client (which has the new keys). Therefore, the recreated
client will be able to decrypt the vault items properly.
2017-10-20 17:46:29 +02:00
James Bardin 36b8be43e8 use the new version package
Update all references to the version values to use the new package.
The VersionString function was left in the terraform package
specifically for the aws provider, which is vendored. We can remove that
last call once the provider is updated.
2017-10-19 21:48:08 -04:00
James Bardin 3f6a7f3ed2 add a terraform version package
Many terraform project packages now want access to the current terraform
version information. Since most packages end up being consumed by the
core terraform package, preventing import cycles becomes difficult.
2017-10-19 19:18:17 -04:00
Martin Atkins d5b0beac01 svchost/auth: static credentials source
This uses an in-memory table of credentials keyed on hostname. This is
the simplest possible credentials source that can actually return
credentials, and is suitable for representing statically-configured
credentials from configuration.
2017-10-19 11:18:43 -07:00
Martin Atkins 865e61b4ea main+command: provide service disco and creds to commands
The command package is the main place we need access to these, so that
we can use them during init (to install packages, for example) and so that
we can use them to configure remote backends.

For the moment we're just providing an empty credentials object, which
will start to include both statically-configured and
helper-program-provided credentials sources in subsequent commits.
2017-10-19 11:18:43 -07:00
Martin Atkins 0db521a281 svchost/auth: expose a "NoCredentials" credentials source
For situations where no credentials are needed but where a working
CredentialsSource is still required, this variable provides a convenient
way to get a fully-functional-but-empty credentials source.
2017-10-19 11:18:43 -07:00
Martin Atkins 83b098344b svchost/disco: add credentials, if available, to disco requests
Although service discovery metadata is usually not sensitive, a service
host may wish to produce different results depending on the requesting
user, such as if users are migrating between two different implementations
that are both running concurrently for some period.
2017-10-19 11:18:43 -07:00
Martin Atkins fcff4cbc95 svchost/auth: caching credentials source
This credentials source wraps another and caches its results in memory
in a map that is keyed on the request hostname.

This should ease the common case of many services operating on the same
hostname by allowing an initial set of credentials to be re-used for
subsequent requests.
2017-10-19 11:18:43 -07:00
Martin Atkins 981c95f699 svchost/auth: CredentialsSource that runs an external program
This CredentialsSource can serve as an extension point to pass credentials
from an arbitrary external system to Terraform. For example, an external
helper program could fetch limited-time credentials from HashiCorp Vault
and return them, thus avoiding the need for any static configuration to
be maintained locally (except a Vault token!).

So far there are no real programs implementing this protocol, though this
commit includes a basic implementation that we use for unit tests.
2017-10-19 11:18:43 -07:00
Martin Atkins 1b60e8fdb6 svchost/auth: HostCredentialsFromMap function
This function deals with turning a map derived from some user input
(e.g. in a config file) into a HostCredentials object, if possible. This
will be used as a standard way to specify credentials so we have a place
to add new credentials types in future and have support for those across
all of our map-based CredentialsSources.
2017-10-19 11:18:43 -07:00
Martin Atkins 43a3357473 svchost/auth: token-based HostCredentials
This is the only credentials type we support right now, which just sends
an opaque token via the "Bearer" HTTP auth scheme.
2017-10-19 11:18:43 -07:00
Martin Atkins 3c65b5dd61 svchost/auth: package for looking up credentials for service hosts
This commit establishes the primary types involved here. Subsequent
commits will add specific implementations of these interfaces.
2017-10-19 11:18:43 -07:00
Martin Atkins 6cd9a8f9c2 svchost/disco: lookup of service URLs within a discovered map
This package implements our Terraform-native Service discovery protocol,
which allows us to find the base URL for a particular service given a
hostname that was already validated and normalized by the svchost package.
2017-10-19 11:18:43 -07:00
Martin Atkins db08ee4ac5 svchost: new package for wrangling service hostnames
We're starting to expose a number of so-called "Terraform-native services"
that can be offered under a friendly hostname. The first of these will
be module registry services, as they expand from the public
Terraform Registry to private registry services within Terraform
Enterprise and elsewhere.

This package is for wrangling these "friendly hostnames", which start
their lives as user-specified unicode strings, can be converted to
Punycode for storage and comparison, and can in turn be converted back
into normalized unicode for display to the user.
2017-10-19 11:18:43 -07:00