Commit Graph

22675 Commits

Author SHA1 Message Date
Sander van Harmelen 5e11de460a
Merge pull request #19130 from hashicorp/f-state-push-pull
command/state: update and fix the state push and pull
2018-10-19 19:16:00 +02:00
Sander van Harmelen 7fbd93b5cd command/state: update and fix the state push and pull 2018-10-19 19:12:23 +02:00
Sander van Harmelen a88ba31b63
Merge pull request #19129 from hashicorp/f-show-list
command/state: update and fix the state list command
2018-10-19 19:10:09 +02:00
Sander van Harmelen 83168ea25f
Merge pull request #19127 from hashicorp/b-prepare-provider
Make the test compile again
2018-10-19 19:05:18 +02:00
Martin Atkins fb57933f13
Update CHANGELOG.md 2018-10-19 09:58:22 -07:00
Sander van Harmelen ecfcb23740
Merge pull request #19128 from hashicorp/b-fix-tf-show
Terraform show didn’t show absolute paths
2018-10-19 18:58:10 +02:00
Sander van Harmelen af1a471a05 command/state: update and fix the state list command 2018-10-19 16:31:12 +02:00
Sander van Harmelen 4d6626b3a8 Terraform show didn’t show absolute paths
Without using absolute paths any module info is lost in the output. And the attributes were randomly ordered and so changed between different executions of the command.
2018-10-19 15:38:11 +02:00
Sander van Harmelen b846c5f653 Make the test compile again
Not sure if these checks still make sense, but without this change the test don’t compile for the related packages.
2018-10-19 15:29:14 +02:00
Martin Atkins 17b883f592 command/format: Include variable values in diagnostic messages
When HCL encounters an error during expression evaluation, it annotates
its diagnostics with information about the expression that was being
evaluated and the EvalContext it was evaluated in.

This gives us enough information to show helpful hints to the user about
the final values of any reference expressions that are present in the
expression, which is very useful extra context for expressions that get
evaluated multiple times, such as:
- Any expression in a block with "count" or "for_each" set
- The sub-expressions within a "for" expression
2018-10-18 17:12:01 -07:00
Martin Atkins 8d100bfde9 tfdiags: Expose expression evaluation information from diagnostics
HCL diagnostics relating to expression evaluation include these, so this
is really just to pass that information through our Terraform-specific
diagnostics interface.
2018-10-18 17:12:01 -07:00
James Bardin 625145563a
Merge pull request #19121 from hashicorp/jbardin/simple-diff
add old values when computing the new InstanceDiff
2018-10-18 20:10:56 -04:00
James Bardin 9fe391cee7
Merge pull request #19120 from hashicorp/jbardin/is-known
Check IsKnown where values may panic
2018-10-18 20:06:44 -04:00
James Bardin ff4e81cc2b add old values when computing the new InstanceDiff
This was previously done in the RequiresNew code, which is skipped in
new style provider.
2018-10-18 20:05:33 -04:00
Chris Doherty 072f73a381
Merge pull request #19118 from hashicorp/cd/vagrantfile-go-1.11.1
Update the Vagrantfile to install Go 1.11.1.
2018-10-18 18:38:17 -05:00
James Bardin e08a388d3c check IsKnown on values that may panic 2018-10-18 19:21:32 -04:00
James Bardin 9434591652
Merge pull request #19117 from hashicorp/jbardin/coerce-value
use correct block types in CoerceValue
2018-10-18 19:21:09 -04:00
James Bardin 9e3c23d890 verify that all LengthInt calls are known
There were some funcs with LengthInt calls on unknown values
2018-10-18 19:19:59 -04:00
Kristin Laemmert e7907d1acd
Merge pull request #19119 from hashicorp/kristin/vendoring-fun
vendor: upgrade ssh-agent dependency
2018-10-18 16:05:56 -07:00
Kristin Laemmert 377077c060 vendor: upgrade ssh-agent dependency 2018-10-18 15:38:22 -07:00
Chris Doherty 62860a56e2 Update the Vagrantfile to install Go 1.11.1. 2018-10-18 15:34:55 -07:00
James Bardin b3a491d035 use correct block types in CoerceValue
When creating Null or Unknown values during CoerceValue, the the outer
block type was being used rather than the current block type.
2018-10-18 18:09:43 -04:00
Chris Griggs c98f2087fb
Merge pull request #19105 from cgriggs01/cgriggs01-linode-2
[Website] Linode documentation links
2018-10-18 11:12:19 -07:00
Martin Atkins ec57927ea3 build: Take protoc out of the "go generate" path
Since protoc is not go-gettable, and most development tasks in Terraform
won't involve recompiling protoc files anyway, we'll use a separate
mechanism for these.

This way "go generate" only depends on things we can "go get" in the
"make tools" target.

In a later commit we should also in some way specify a particular version
of protoc to use so that we don't get "flapping" regenerations as
developers work with different versions, but the priority here is just to
make "make generate" minimally usable again to restore the dev workflow
documented in the README.

This also includes some updates that resulted from running "make generate"
and "make protobuf" after those Makefile changes were in place.
2018-10-18 10:39:20 -07:00
James Bardin 47921bddb7
Merge pull request #19114 from hashicorp/jbardin/provider-defaults
don't set defaults for deprecated or removed
2018-10-18 13:01:02 -04:00
James Bardin a8f75bc554 don't set defaults for deprecated or removed
These may still have defaults set, even if they are not intended to be
used.
2018-10-18 12:45:55 -04:00
James Bardin fcbc896bc1
Merge pull request #19112 from hashicorp/jbardin/provider-config
Insert default values into provider config
2018-10-18 11:55:28 -04:00
James Bardin e077c9ce95 Insert default values into provider config
Add any top-level default attributes from the provider schema into Null
config values.
2018-10-18 11:40:47 -04:00
James Bardin 6317d529a9
Merge pull request #19111 from hashicorp/jbardin/provider-config
PrepareProviderConfig for terraform provider
2018-10-18 11:15:15 -04:00
James Bardin ac5f08c5d8 PrepareProviderConfig for terraform provider 2018-10-18 11:12:56 -04:00
James Bardin e377b8878d
Merge pull request #19110 from hashicorp/jbardin/provider-config
PrepareProviderConfig
2018-10-18 10:53:06 -04:00
James Bardin a3ac49b3fb GRPCProviderServer and PrepareProviderconfig
Update the server side of the plugin to match the new method signature.
2018-10-18 08:48:55 -04:00
James Bardin 155f899249 update terraform with PrepareProviderConfig
Change the call sites and update the MockProvider. No core behavior is
changed yet.
2018-10-18 08:48:55 -04:00
James Bardin 3bdd3b2a6e update plugin client with PrepareProviderConfig 2018-10-18 08:48:54 -04:00
James Bardin b173037eb3 update mock for PrepareProviderConfig 2018-10-18 08:48:54 -04:00
James Bardin ba472c7059 Update proto with new PrepareProviderConfig method 2018-10-18 08:48:54 -04:00
Radek Simko a656bcb263
Update CHANGELOG.md 2018-10-18 06:29:08 +01:00
Radek Simko d6f7577955
Merge pull request #19086 from hashicorp/f-file-exists-func
lang: Add file_exists function
2018-10-18 06:25:56 +01:00
James Bardin c1303f8482 providers PrepareProviderConfig
Change ValidateProviderConfig to PrepareProviderConfig.

Providers have a concept of "required fields with defaults" that that
was handled previously by helper/schema doing input and validation.
Because Input and Validation is mostly now handled by core, the provider
had no way of setting default values for missing required attributes.

To achieve the same behavior with new providers, there will be a
PrepareProviderConfig, which allow for manual validation, as well as
alteration of the config. The provider is free to set whatever
attributes necessary to create a valid config and return it to the
caller. If a new config is returned, it will be used instead of the
original in the subsequent Configure call, however core may still add
missing required values during an optional Input phase.
2018-10-17 21:31:52 -04:00
Martin Atkins 55c3f9b9c0 vendor: upgrade to latest github.com/zclconf/go-cty
This contains a fix for a panic in Value.HasElement when used on a set
value whose element type is an object or tuple.

A few other minor dependency upgrades came long for the ride.
2018-10-17 17:02:47 -07:00
Martin Atkins 9b4b43c077 plans/objchange: Don't panic when a prior value with a set is null
ProposedNewObject intentionally replaces a null prior with an unknown
prior in order to easily fill in unknown values where they "show through"
under values not set explicitly in config, but it was failing to handle
that situation when dealing with nested blocks that are backed by sets.
2018-10-17 17:02:47 -07:00
Martin Atkins 628c3a38b9 Catch up the CHANGELOG after the v0.12 development branch merge
Due to the unusual way v0.12 was developed (because of the large amount
of cross-cutting refactoring) we have not built out an incremental
changelog along the way as we normally would.

This is an initial catchup of the changelog for the current tree at the
time of writing, with the intent that we will maintain this in the usual
way moving forward as we head towards the v0.12-alpha1 release.
2018-10-17 16:31:59 -07:00
cgriggs01 a48dda2acc add linode documentation links 2018-10-17 14:20:39 -07:00
Sander van Harmelen 48ef7ecfa6 Updates after running `make fmt` with Go v1.11.1 2018-10-17 14:11:08 -07:00
Brian Flad 02e135bac8
Merge pull request #19102 from hashicorp/v-helper-validation-All-IntInSlice
helper/validation: Add All() and IntInSlice() SchemaValidateFunc
2018-10-17 14:39:03 -04:00
Brian Flad 17ac9a5756
helper/validation: Add All() and IntInSlice() SchemaValidateFunc
`All()` combines the outputs of multiple `SchemaValidateFunc`, to reduce the usage of custom validation functions that implement standard validation functions.

Example provider usage:

```go
ValidateFunc: validation.All(
  StringLenBetween(5, 42),
  StringMatch(regexp.MustCompile(`[a-zA-Z0-9]+`), "value must be alphanumeric"),
),
```

`IntInSlice()` is the `int` equivalent of `StringInSlice()`

Example provider usage:

```go
ValidateFunc: validation.IntInSlice([]int{30, 60, 120})
```

Output from unit testing:

```
$ make test TEST=./helper/validation
==> Checking that code complies with gofmt requirements...
go generate ./...
2018/10/17 14:16:03 Generated command/internal_plugin_list.go
go list ./helper/validation | xargs -t -n4 go test  -timeout=2m -parallel=4
go test -timeout=2m -parallel=4 github.com/hashicorp/terraform/helper/validation
ok  	github.com/hashicorp/terraform/helper/validation	1.106s
```
2018-10-17 14:22:29 -04:00
James Bardin 9143cb5b49
Merge pull request #19101 from hashicorp/jbardin/resource-tests
helper/resource tests
2018-10-17 13:10:38 -04:00
James Bardin 9c2f3ebe17
Merge pull request #19100 from hashicorp/jbardin/command-tests
Backend config and command tests
2018-10-17 13:10:21 -04:00
James Bardin 1ab96f42b7 fail nonfunctional resource tests
The helper/resource unit tests will panic, because they were using the
legacy terraform.MockResourceProvider, which doesn't have the same
internals required by the new GRPC shims.

Fail these tests for now, and a new test provider will need to be made
out of a schema.Provider instance.
2018-10-17 12:51:07 -04:00
James Bardin 3a0c2f1b67 close grpc TestListener 2018-10-17 12:13:59 -04:00