Commit Graph

50 Commits

Author SHA1 Message Date
Kristin Laemmert d2e999ba1f
remove unused code (#26503)
* remove unused code

I've removed the provider-specific code under registry, and unused nil
backend, and replaced a call to helper from backend/oss (the other
callers of that func are provisioners scheduled to be deprecated).

I also removed the Dockerfile, as our build process uses a different
file.

Finally I removed the examples directory, which had outdated examples
and links. There are better, actively maintained examples available.

* command: remove various unused bits

* test wasn't running

* backend: remove unused err
2020-10-07 11:00:06 -04:00
Alisdair McDiarmid 1c1df6dc50 registry: Fix panic when server is unreachable
Non-HTTP errors previously resulted in a panic due to dereferencing the
resp pointer while it was nil, as part of rendering the error message.
This commit changes the error message formatting to cope with a nil
response, and extends test coverage.

Fixes #24384
2020-03-19 10:20:10 -04:00
Kim Ngo d88729d922
registry: configurable client timeout (#24259)
* registry: configurable client timeout

* Update registry/client_test.go

    Fix env test cleanup

    Co-Authored-By: Alisdair McDiarmid <alisdair@users.noreply.github.com>
2020-03-05 10:37:06 -06:00
findkim bb968634ac registry: fix env test cleanup 2020-03-03 13:52:39 -06:00
findkim 4f55721c2e registry: setup client logger 2020-03-03 11:22:34 -06:00
findkim a3f26ccd12 website/docs/commands: document TF_REGISTRY_DISCOVERY_RETRY 2020-03-03 10:08:36 -06:00
findkim d0e13320d5 registry: configurable retry client 2020-02-14 13:29:00 -06:00
Radek Simko 32f9722d9d
Replace import paths & set UA string where necessary 2019-10-11 22:40:54 +01:00
Justin Campbell bb52552c17 registry/response: Remove unused verified bool 2019-08-07 12:33:51 -04:00
Radek Simko 5b9f2fafc8 Standardise directory name for test data 2019-06-30 10:16:15 +02:00
Pam Selle d72456d188 Add friendly error for when registry unresponsive
If the registry is unresponsive, you will now get an error
specific to this, rather than a misleading "provider unavailable" type
error. Also adds debug logging for when errors like this may occur
2019-03-27 14:39:14 -04:00
Justin Campbell e6316c9de6 plugin/discovery: Parse warnings from TF Registry
Terraform Registry (and other registry implementations) can now return
an array of warnings with the versions response. These warnings are now
displayed to the user during a `terraform init`.
2019-03-18 12:21:27 -04:00
Sander van Harmelen 973e2a7cf9 core: add a context to the UIInput interface 2019-03-08 10:24:40 +01:00
Sander van Harmelen a5a2156584 core: enhance service discovery
This PR improves the error handling so we can provide better feedback about any service discovery errors that occured.

Additionally it adds logic to test for specific versions when discovering a service using `service.vN`. This will enable more informational errors which can indicate any version incompatibilities.
2018-12-10 20:52:05 +01:00
findkim 5e06e39fcc Use registry alias to fetch providers 2018-11-28 11:54:39 -06:00
Justin Campbell c993e9bed6 registry/response: Add protocols to DL resp 2018-11-20 14:09:16 -05:00
Justin Campbell 495826444b plugin/discovery: Use GPG keys from Registry
When verifying the signature of the SHA256SUMS file, we have been
hardcoding HashiCorp's public GPG key and using it as the keyring.

Going forward, Terraform will get a list of valid public keys for a
provider from the Terraform Registry (registry.terraform.io), and use
them as the keyring for the openpgp verification func.
2018-11-20 14:09:16 -05:00
Sander van Harmelen 52a1b22f7a Implement the remote enhanced backend
This is a refactored version of the `remote` backend that was initially added to Terraform v0.11.8 which should now be compatible with v0.12.0.
2018-11-06 16:29:46 +01:00
Kristin Laemmert 5e7956f440 registry/response: rename Collection to ProviderVersionCollection for clarity 2018-10-16 18:58:49 -07:00
Kristin Laemmert bdaf8290b4 registry/client: added a specific error if the registry client does not
support the requested service.
2018-10-16 18:58:49 -07:00
Kristin Laemmert f83d5866fe plugin/discovery: removing deprecated functions 2018-10-16 18:58:49 -07:00
Kristin Laemmert ce5e66e178 plugin/discovery provider installer: download providers from the registry
Terraform will query the public registry at
https://registry.terraform.io for providers, instead of
https://releases.hashicorp.com.
2018-10-16 18:56:50 -07:00
Kristin Laemmert d1f27ce8c2 registry: renaming module-specific registry functions 2018-10-16 18:56:50 -07:00
Kristin Laemmert 082af84131 registry: adding provider functions to registry client 2018-10-16 18:53:51 -07:00
Sander van Harmelen 179b32d426 Add a `CredentialsForHost` method to disco.Disco
By adding this method you now only have to pass a `*disco.Disco` object around in order to do discovery and use any configured credentials for the discovered hosts.

Of course you can also still pass around both a `*disco.Disco` and a `auth.CredentialsSource` object if there is a need or a reason for that!
2018-08-03 11:29:11 +02:00
Sander van Harmelen 2c0c3771a9 Make sure to close the response body
And fix a few linter warnings while we're at it…
2018-06-29 16:14:54 +02:00
Paul Tyng c868092d2d
Standardize http.Client creation with User-Agent 2018-02-28 12:09:50 -05:00
Paul Tyng 344e8fca05
Relax typing to allow for http.RoundTripper 2018-02-28 11:40:17 -05:00
Martin Atkins 59939cf320 configs/configload: installation from registry and go-getter
Unlike the old installer in config/module, this uses new-style
installation directories that include the static module path so that paths
we show in diagnostics will be more meaningful to the user.

As before, we retrieve the entire "package" associated with the given
source string, rather than any given subdirectory directly, because the
retrieved module may contain ../ references into parent directories which
must be resolvable after extraction.
2018-02-15 15:56:39 -08:00
James Bardin eba73a3bb4
Merge pull request #17134 from hashicorp/jbardin/GH-17119
the trailing slash check caused a nil dereference
2018-01-17 19:07:19 -05:00
James Bardin 38f76ddc4e the trailing slash check caused a nil dereference
The disco package doesn't return errors, and a nil value indicates that
the input isn't valid. Always check for nil.
2018-01-17 18:31:05 -05:00
Masayuki Morita f440dba137 Standardize on log level "WARN" rather than "WARNING" 2018-01-16 18:05:26 -08:00
James Bardin 34b4000be9 allow discovery without trailing slash 2017-12-05 15:09:16 -05:00
James Bardin 91bd72f22b Create a registry.Client
This moves the registry specific functionality out of the module.Storage
and into its own package.
2017-12-05 14:58:48 -05:00
James Bardin 23d21b373e Add registry/test package
Move the mock regisry and helpers to this package, so they can used by
tests in both the registry and config/module packages.
2017-12-05 14:58:48 -05:00
James Bardin 9034fdb050 make sure invalid hosts aren't compared
Comparing 2 invalid hosts would erroneously return equal, because they
would compare the invalid host string.
2017-11-20 18:29:09 -05:00
James Bardin 8091bd627d move Svchost method to regsrc.Module
The level of abstraction that needs the "svchost" is the Module, not the
FriendlyHost. Us the new method in the module package for registry
interaction.
2017-11-20 18:29:09 -05:00
James Bardin 87f23d9719 add Module method for module name only 2017-11-20 16:48:11 -05:00
James Bardin 92db96f783 disallow github and bitbucket 2017-11-20 16:44:50 -05:00
James Bardin 98d0d15ddc Update the FriendlyHost tests for svchost.Hostname
This no longer allows normalization of punycode hostnames. This
shouldn't be a problem, as they were not valid in the first place.
2017-11-20 16:11:39 -05:00
James Bardin 1ac5871a09 use svchost.Hostname for FriendlyHost validation
Use the svchost.Hostname for FriendlyHost normalization and validation.
2017-11-20 16:09:27 -05:00
James Bardin 9162213b01 reimport the registry regsrc module 2017-11-20 15:12:10 -05:00
James Bardin 0d10564a74 remove the registryDetector
The detection of registry modules will have to happen in mutliple
phases. The go-getter interface requires that the detector return the
final URL, while we won't know that until we verify which version we
need. This leaves the regisry sources broken, to be re-integrated in a
following commit.
2017-10-27 09:08:15 -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