Commit Graph

24371 Commits

Author SHA1 Message Date
Radek Simko cb39836705
Merge pull request #19995 from hashicorp/f-cmd-fmt-reduce-diff
command/format: Reduce whitespaces in empty fields
2019-01-15 16:25:19 +00:00
Sander van Harmelen 9ba5b1b507
Merge pull request #20010 from hashicorp/svh/f-remote-backend
backend/remote: use the correct test operation
2019-01-15 16:37:09 +01:00
Sander van Harmelen e08a7e979e backend/remote: use the correct test operation 2019-01-15 16:13:16 +01:00
Sander van Harmelen 4d9da13d85 go-mod: update dependencies 2019-01-15 15:52:37 +01:00
Radek Simko 13896d72c5
command/format: Render empty object as {} 2019-01-15 14:34:49 +00:00
Radek Simko 5f14b7a7f2
command/format: Render empty primitive list/set as [] 2019-01-15 14:34:49 +00:00
Radek Simko 09d19ca9d9
command/format: Render empty JSON object as {} 2019-01-15 14:34:48 +00:00
Radek Simko 0dd2d56f18
command/format: Render empty maps as {} 2019-01-15 14:34:46 +00:00
Radek Simko ea05da89cb
states/statemgr: Avoid HTML escaping when printing LockInfo 2019-01-15 10:57:31 +00:00
Martin Atkins 0995559934 go mod tidy 2019-01-14 17:39:16 -08:00
Kim Ngo 41a2376915
Merge pull request #19981 from findkim/colorize-protocol-mismatch-msg
Condense protocol mismatch UI error message
2019-01-14 15:12:09 -06:00
findkim 6e0de3e3f5 Nest incompatible provider protocol error to include dynamic custom msg 2019-01-14 14:56:47 -06:00
Radek Simko 1c660cc39f
Update CHANGELOG.md 2019-01-14 20:34:28 +00:00
Radek Simko aae87c7921
Merge pull request #19990 from hashicorp/f-cmd-fmt-ignore-empty-str
command/format: Ignore removal of empty strings
2019-01-14 20:33:43 +00:00
Martin Atkins 86c02d5c35 command: "terraform init" can partially initialize for 0.12upgrade
There are a few constructs from 0.11 and prior that cause 0.12 parsing to
fail altogether, which previously created a chicken/egg problem because
we need to install the providers in order to run "terraform 0.12upgrade"
and thus fix the problem.

This changes "terraform init" to use the new "early configuration" loader
for module and provider installation. This is built on the more permissive
parser in the terraform-config-inspect package, and so it allows us to
read out the top-level blocks from the configuration while accepting
legacy HCL syntax.

In the long run this will let us do version compatibility detection before
attempting a "real" config load, giving us better error messages for any
future syntax additions, but in the short term the key thing is that it
allows us to install the dependencies even if the configuration isn't
fully valid.

Because backend init still requires full configuration, this introduces a
new mode of terraform init where it detects heuristically if it seems like
we need to do a configuration upgrade and does a partial init if so,
before finally directing the user to run "terraform 0.12upgrade" before
running any other commands.

The heuristic here is based on two assumptions:
- If the "early" loader finds no errors but the normal loader does, the
  configuration is likely to be valid for Terraform 0.11 but not 0.12.
- If there's already a version constraint in the configuration that
  excludes Terraform versions prior to v0.12 then the configuration is
  probably _already_ upgraded and so it's just a normal syntax error,
  even if the early loader didn't detect it.

Once the upgrade process is removed in 0.13.0 (users will be required to
go stepwise 0.11 -> 0.12 -> 0.13 to upgrade after that), some of this can
be simplified to remove that special mode, but the idea of doing the
dependency version checks against the liberal parser will remain valuable
to increase our chances of reporting version-based incompatibilities
rather than syntax errors as we add new features in future.
2019-01-14 11:33:21 -08:00
Martin Atkins 0c0a437bcb Move module install functionality over to internal/initwd 2019-01-14 11:33:21 -08:00
Martin Atkins 047239e68c vendor: Add github.com/hashicorp/terraform-config-inspect 2019-01-14 11:33:21 -08:00
Martin Atkins e27e0ddc9e internal/init: Module installation functionality
This is an adaptation of the installation code from configs/configload,
now using the "earlyconfig" package instead of the "configs" package.

Module installation is an initialization-only process, with all other
commands assuming an already-initialized directory. Having it here can
therefore simplify the API of configs/configload, which can now focus only
on the problem of loading modules that have already been installed.

The old installer code in configs/configload is still in place for now
because the caller in "terraform init" isn't yet updated to use this.
2019-01-14 11:33:21 -08:00
Martin Atkins 53ee858851 internal/init: Package for helpers of the "terraform init" command
"terraform init" is quite a complex beast in relation to other commands
since almost everything it does is unique to it and thus not factored out
into other packages.

To get some of that sprawl out of the "command" package, this new internal
package will give us somewhere to put this init functionality that is
also useful for test code that needs to mimic the initialization behavior
against fixture directories.
2019-01-14 11:33:21 -08:00
Martin Atkins 0ce2add59f internal/modsdir: Factor out module manifest models to separate package 2019-01-14 11:33:21 -08:00
Martin Atkins 8ca1fcec51 internal/earlyconfig: Liberal config parsing for init
This is an alternative to the full config loader in the "configs" package
that is good for "early" use-cases like "terraform init", where we want
to find out what our dependencies are without getting tripped up on any
other errors that might be present.
2019-01-14 11:33:21 -08:00
Radek Simko d96f4fa77b
command/format: Ignore removal of empty strings 2019-01-13 22:56:04 +00:00
James Bardin 21d65cfa9a
Merge pull request #19988 from hashicorp/jbardin/refresh-shims
Don't add empty blocks to config, and fix ReadResource
2019-01-13 10:16:37 -05:00
James Bardin 041ed67e46 type names don't imply the resource mode
The addr type doesn't imply the resource mode, so data sources and
managed resources with the same type name could shim incorrectly.
2019-01-12 11:43:48 -05:00
James Bardin e8096e9c8b normalize values during ReadResource
Match the normalization behavior of Apply, so we don't end up causing
any diffs between zero values when refreshing resources.
2019-01-12 10:41:04 -05:00
James Bardin c7269bec02 Revert "insert empty objects into config from empty blocks"
This reverts commit 3677522a28.
Later changes negate the need for this, and removing these again
prevents us from having to strip them back out when helper/schema
doesn't want them.
2019-01-12 10:41:04 -05:00
James Bardin 9b89f6ecc6 add tests for deprecated/removed attrs 2019-01-12 10:41:04 -05:00
Nick Fagerlund ac45e43fda website: Finish moving "writing custom providers" to /docs/extend/
This document was previously copied to the "Extending Terraform" section (in the
terraform-website repo), and the old URL was redirected so that the copy in
/guides can no longer be reached on the website. But the old copy of the file
remained, and now it runs the risk of confusing contributors, since the copy in
terraform-website/.../docs/extend is the more up-to-date version.
2019-01-11 16:36:40 -08:00
Kristin Laemmert 5df9cd0f52
command/show: tests for -json output (#19980)
* command/show: added test scaffold for json output

More test cases will be added once the basic shape of the tests is
validated.

- command/json* packages now sort resources by address, matching
behavior elsewhere
- using cmp in tests instead of reflect.DeepEqual for the diffs
- updating expected output in tests to match sorting
2019-01-11 15:13:55 -08:00
Kim Ngo e168d81894
Merge pull request #19977 from findkim/filter-prerelease-provider-protocol-mismatch
Prerelease versions are filtered for plugin protocol mismatches
2019-01-11 14:59:14 -06:00
Scott Stevenson cef46ef953
Add details about using lock=true when consul ACL is enabled
This PR addresses https://github.com/hashicorp/terraform/issues/19963.
2019-01-11 14:43:56 -05:00
Radek Simko 9948d61c0a
Update CHANGELOG.md 2019-01-11 19:27:49 +00:00
Radek Simko bc4b7cad68
command/format: Render null in dark gray (#19616) 2019-01-11 19:27:09 +00:00
findkim f75d83c1cd Prerelease versions are filtered for plugin protocol mismatches 2019-01-11 12:56:47 -06:00
Kim Ngo c5ea0f7d9b
Merge pull request #19976 from findkim/protocol-dl-compat-msg
Add provider protocol compatibility UI err msg during registry discovery
2019-01-11 12:21:36 -06:00
findkim 368ac85a26 Add provider protocol compatibility UI err msg during registry discovery 2019-01-11 11:28:09 -06:00
Brian Flad 1b9a392c01
Update CHANGELOG for #19951 2019-01-11 10:09:15 -05:00
Brian Flad 05691a978e
Merge pull request #19951 from hashicorp/s3-backend-nosuchbucket-enhanced-error
backend/s3: Configure AWS Client MaxRetries and provide enhanced S3 NoSuchBucket error message
2019-01-11 10:04:16 -05:00
James Bardin 056892b410
Merge pull request #19971 from hashicorp/jbardin/resource-data-id
make sure id really gets set in SetId
2019-01-10 20:53:14 -05:00
James Bardin bc5eecd7f2 make sure id really gets set in SetId
SetId needs to overwrite the newState as well, since the internal calls
to DataSource.Id() will override the set attribute.
2019-01-10 20:28:11 -05:00
James Bardin 21aadb0456
Merge pull request #19960 from hashicorp/jbardin/resource-test-shims
Resource test shims
2019-01-10 13:30:26 -05:00
James Bardin 3e3802c36f update existing test provider test 2019-01-10 13:08:54 -05:00
James Bardin f4fe6d6716 add tests with set hashes to the test provider
These are representative of things that real-world providers use in
tests.
2019-01-10 12:26:53 -05:00
James Bardin a7b399cb4c use actual schema.Resources for state shims
Provider tests often rely on checking values contained within sets, by
directly accessing their flatmapped representation. In order to provider
the test harness with the expected set hashes, the sets must be
generated by the schema.Resource itself.

During the test we now build a fixed map of the providers, which should
only contain schema.Provider instances, and pass them into each
TestStep. The individual schema.Resource instances can then be pulled
from the providers, and used to recreate the state from the cty.Value
returned by the core operations.
2019-01-10 12:20:03 -05:00
Kim Ngo 090da574a2
Merge pull request #19954 from findkim/fix-provider-protocol-tests
Fix plugin protocol test
2019-01-10 09:02:34 -06:00
Chris Griggs 7463d1a247
Merge pull request #19952 from cgriggs01/cgriggs01-comm-5
[Website] Add new community providers
2019-01-09 14:31:57 -08:00
Chris Griggs 0cc057b873
Merge branch 'master' into cgriggs01-comm-5 2019-01-09 14:31:47 -08:00
Tom Harvey 177ca3711d
Adding the AzureAD entry to the providers page (#19946)
Adding the AzureAD entry to the providers page
2019-01-09 22:28:25 +00:00
findkim 43b22d4e14 Fix plugin protocol test 2019-01-09 15:20:33 -06:00
cgriggs01 a9069cab7b edit fmt 2019-01-09 11:40:34 -08:00