Commit Graph

23958 Commits

Author SHA1 Message Date
Sander van Harmelen 9ab2e9d8b2 Make sure UIInput keeps working after being canceled
Once you start reading from stdin, that is a blocking call that will
never finish. So when a context is canceled causing the input method to
return, the read will remain blocking in the running goroutine.

There isn't a real solution for it (e.g. its not possible to unblock the
read) so the only solution is to make the reader reusable.
2019-04-29 15:15:26 +02:00
Brian Flad c70c198f10
Update CHANGELOG for #21117 2019-04-25 20:09:24 -04:00
Brian Flad 13bc60cf4f
Merge pull request #21117 from hashicorp/v-aws-sdk-go-v1.19.18
deps: github.com/aws/aws-sdk-go@v1.19.18
2019-04-25 20:07:45 -04:00
Brian Flad f1d7196d10
deps: github.com/aws/aws-sdk-go@v1.19.18
Enables automatic validation for the new `ap-east-1` region. See also: https://github.com/terraform-providers/terraform-provider-aws/pull/8440#pullrequestreview-230896877

Updated via:

```console
$ go get github.com/aws/aws-sdk-go@v1.19.18
$ go mod tidy
$ go mod vendor
```
2019-04-25 18:01:11 -04:00
Martin Atkins 3309be9721 core: Allow data resource count to be unknown during refresh
The count for a data resource can potentially depend on a managed resource
that isn't recorded in the state yet, in which case references to it will
always return unknown.

Ideally we'd do the data refreshes during the plan phase as discussed in
#17034, which would avoid this problem by planning the managed resources
in the same walk, but for now we'll just skip refreshing any data
resources with an unknown count during refresh and defer that work to the
apply phase, just as we'd do if there were unknown values in the main
configuration for the data resource.
2019-04-25 14:22:57 -07:00
Martin Atkins 95e5ef13a7 vendor: go get github.com/zclconf/go-cty@master
This includes a more comprehensive implementation of Value.GoString, along
with various other changes that don't affect Terraform.
2019-04-25 14:22:57 -07:00
Chris Griggs b7705d20a0
Merge pull request #21098 from hashicorp/cgriggs01-add-gridscale
[Website] Add Gridscale provider
2019-04-24 15:02:12 -07:00
Chris Griggs 103f56e0a3
Merge pull request #21090 from hashicorp/cgriggs01-name-update
[Website] Fix FortiOS typo
2019-04-24 14:54:05 -07:00
cgriggs01 bad3c57f00 [Website] Add Gridscale provider 2019-04-24 14:46:22 -07:00
Martin Atkins 4897c0554d vendor: go get github.com/hashicorp/go-msgpack@v0.5.4
By upgrading this to a version that supports Go Modules, we can avoid
the redundant dependencies labix.org/v2/mgo and launchpad.net/gocheck.

These dependencies come via hashicorp/consul, which we have vendored for
the Consul backend.

There are no changes to the go-msgpack code here; we're just adopting a
newer version that has a go.mod present so that its dependencies can be
determined more accurately.
2019-04-24 13:41:33 -07:00
Radek Simko e8ee3f14a4
Merge pull request #21094 from hashicorp/fix-plugin-discovery-quoting
plugin/discovery: Fix quoting of provider name
2019-04-24 21:03:26 +01:00
Radek Simko b171997b39
plugin/discovery: Fix quoting of provider name 2019-04-24 20:47:32 +01:00
Kristin Laemmert 2573d549c2
Update CHANGELOG.md 2019-04-24 14:53:54 -04:00
Kit Ewbank efc08de5d6 lang/funcs: add 'strrev' interpolation function. (#21091) 2019-04-24 14:52:39 -04:00
cgriggs01 bd1b2c8641 fix FortiOS caps 2019-04-24 10:21:16 -07:00
Kristin Laemmert 9327eedb04
internal/initwd: follow local module path symlink (#21063)
* internal/initwd: follow local module path symlink

Fixes #21060

While a previous commit fixed a problem when the local module directory
contained a symlink, it did not account for the possibility that the
entire directory was a symlink.
2019-04-24 08:19:27 -04:00
James Bardin 64f419ac76
Merge pull request #21077 from hashicorp/jbardin/map-shims
Fixes for maps in shims
2019-04-23 14:41:26 -04:00
James Bardin 2fe0f9376a change "preferDst" to "apply" in normalizeNullVals
Inverting this and renaming it makes it align with the current use of
that boolean argument.
2019-04-23 12:59:30 -04:00
James Bardin 0696cf7245 don't retain removed map values
Make sure values removed from a map during apply are not copied into the
new map. The broken test is no longer valid in this case, and the
updated diff.Apply should prevent the case it used to cover.
2019-04-23 12:49:58 -04:00
James Bardin 0f883b118a test that computed maps are applied correctly
Verify that a computed map which is not correctly marked as unknown in
the plan is still applied correctly.
2019-04-23 12:31:19 -04:00
James Bardin 3d46c04e28
Merge pull request #21068 from hashicorp/jbardin/get-ok-exists
delete unknown values from apply config altogether
2019-04-23 08:58:38 -04:00
James Bardin 67395306e1 delete unknown values from apply config altogether
removeConfigUnknowns need to remove the value completely from the config
map. Removing this value allows GetOk and GetOkExists to indicate if the
value was set in the config in the case of an Optional+Computed
attribute.
2019-04-22 18:06:26 -04:00
Ross McKelvie ce1fba5817 website: update required_providers block for terraform 0.12 compatibility 2019-04-19 11:54:19 -07:00
Ryan 1a53575b15 build: use correct link for GCP provider in GitHub issue template 2019-04-18 14:06:24 -07:00
Martin Atkins 168592825e release: clean up after v0.12.0-beta2 2019-04-18 17:30:16 +00:00
Chris Griggs aeabdf1a0d
Merge pull request #21054 from cgriggs01/cgriggs01-community-patch
[Website] Adding community provider
2019-04-18 09:19:39 -07:00
Pam Selle 3f68b12e3a
Merge pull request #20959 from mars/patch-1
Update CHANGELOG for #20561
2019-04-18 09:18:36 -07:00
Mars Hall 67b9a11fad Update CHANGELOG for #20561 2019-04-18 11:05:59 -05:00
Martin Atkins 533cbf4c3f
website: Update "Local Values" docs to use v0.12 syntax in example
There was some leftover v0.11-style interpolation syntax here.

We prefer to use a "naked" expression in situations like this where the result
isn't a string, because interpolations returning non-strings is a common source
of confusion for new users.
2019-04-18 09:03:34 -07:00
Chris Griggs f66b563ccd
Merge pull request #21051 from cgriggs01/cgriggs01-fortios-links
[Website] Adding Fortios provider links
2019-04-18 08:37:21 -07:00
cgriggs01 55b816853a [Website] Adding Fortios provider links 2019-04-18 07:46:30 -07:00
Martin Atkins 62d32e9bb3 website: Fix incorrect example in Module Composition page
The example above treats recordsets as a list, but the declaration was for a single object.
2019-04-18 07:13:16 -07:00
cgriggs01 26d515e40a Adding community provider 2019-04-17 15:57:24 -07:00
Alex Somesan 275e0a53f2
Merge pull request #20851 from hashicorp/doc-validatefunc-maps
Document that ValidateFunc works on maps.
2019-04-17 20:45:15 +02:00
Paul Tyng 6bd7fdbb6b
Merge pull request #21043 from hashicorp/paultyng-patch-1
godoc typo
2019-04-17 14:37:01 -04:00
Martin Atkins 2238fbda1b website: v0.12 upgrade guide about list variables and brackets 2019-04-17 11:16:16 -07:00
Alex Somesan 01a169c66f make fmt 2019-04-17 19:58:06 +02:00
Kristin Laemmert 83dea200c0
Update CHANGELOG.md 2019-04-17 13:50:02 -04:00
Przemysław Dąbek 9605b093d9 command/graph: use user-supplied plugin path when running graph command (#18083) 2019-04-17 13:48:11 -04:00
Paul Tyng ab2d09b0cb
godoc typo 2019-04-17 13:45:58 -04:00
Martin Atkins cbc8d1eba2 core: Input variables are always unknown during validate
Earlier on in the v0.12 development cycle we made the decision that the
validation walk should consider input values to always be unknown so that
validation is checking validity for all possible inputs rather than for
a specific set of inputs; checking for a specific set of inputs is the
responsibility of the plan walk.

However, we didn't implement that in the best way: we made the
"terraform validate" command force all of the input variables to unknown
but that was insufficient because it didn't also affect the implicit
validation walk we do as part of "terraform plan" and "terraform apply",
causing those to produce confusingly-different results.

Instead, we'll address the problem directly in the reference resolver code,
ensuring that all variable values will always be treated as an unknown
(of the declared type, so type checking is still possible) during any
validate walk, regardless of which command is running it.
2019-04-17 10:09:46 -07:00
Martin Atkins d7f23f0beb configs/configupgrade: Don't panic if analyzer fails
Previously we were trying to access a field of the analysis object before
checking if analysis produced errors. The analysis function usually
returns a nil analysis on error, so this would result in a panic whenever
that happened.

Now we'll dereference the analysis object pointer only after checking for
errors, so we'll get a chance to report the analysis error to the user.
2019-04-17 10:08:54 -07:00
Alex Somesan 0395c3ac58
Re-phrase docs to enumerate types which support ValidateFunc 2019-04-17 18:58:58 +02:00
Martin Atkins 1bb47ab9a5 configs/configupgrade: Preserve comments on items in object exprs
The expression upgrade functionality mostly ignores comments because in
the old language the syntax prevented comments from appearing in the
middle of expressions, but there was one exception: object expressions.

Because HCL 1 used ObjectType both for blocks and for object expressions,
that is the one situation where something we consider to be an expression
could have inline attached comments in the old language.

We migrate these here so we don't lose these comments that don't appear
anywhere else. Other comments get gathered up into a general comments
set maintained inside the analysis object and so will be printed out as
required _between_ expressions, just as they did before.
2019-04-17 07:48:57 -07:00
Martin Atkins 861a2ebf26 helper/schema: Use a more targeted shim for nested set diff applying
We previously attempted to make the special diff apply behavior for nested
sets of objects work with attribute mode by totally discarding attribute
mode for all shims.

In practice, that is too broad a solution: there are lots of other shimming
behaviors that we _don't_ want when attribute mode is enabled. In
particular, we need to make sure that the difference between null and
empty can be seen in configuration.

As a compromise then, we will give all of the shims access to the real
ConfigMode and then do a more specialized fixup within the diff-apply
logic: we'll construct a synthetic nested block schema and then use that
to run our existing logic to deal with nested sets of objects, while
using the previous behavior in all other cases.

In effect, this means that the special new behavior only applies when the
provider uses the opt-in ConfigMode setting on a particular attribute,
and thus this change has much less risk of causing broad, unintended
regressions elsewhere.
2019-04-17 07:47:31 -07:00
Martin Atkins 5f29339121
Update CHANGELOG.md 2019-04-17 07:41:27 -07:00
Martin Atkins ff2de9c818 core: Keep old value on error even for delete
When an operation fails, providers may return a null new value rather than
returning a partial state. In that case, we'd prefer to keep the old value
so that we stand the best chance of being able to retry on a subsequent
run.

Previously we were making an exception for the delete action, allowing
the result of that to be null even when an error is returned. In practice
that was a bad idea because it would cause Terraform to lose track of the
object even though it might not actually have been deleted.

Now we'll retain the old object even in the delete case. Providers can
still return partial new objects if they were able to partially complete
a delete operation, in which case we'll discard what we had before, but
if the result is null with errors then we'll assume the delete failed
entirely and so just keep the old state as-is, giving us the opportunity
to refresh it on the next run to see if anything actually happened after
all.

(This also includes a new resource in the test provider which isn't used
by the patch but was useful for some manual UX testing here, so I thought
I'd include it in case it's similarly useful in future, given how simple
its implementation is.)
2019-04-17 07:40:15 -07:00
Martin Atkins bd1a215580 helper/resource: Ignore Removed attributes for ImportStateVerify
Due to the lossiness of our legacy models for diff and state, shimming a
diff and then creating a state from it produces a different result than
shimming a state directly. That means that ImportStateVerify no longer
works as expected if there are any Computed attributes in the schema where
d.Set isn't called during Read.

Fixing that for every case would require some risky changes to the shim
behavior, so we're instead going to ask provider developers to address it
by adding `d.Set` calls where needed, since that is the contract for
"Computed" anyway -- a default value should be produced during Create, and
thus by extension during Import.

However, since a common situation where this occurs is attributes marked
as "Removed", since all of the code that deals with them has generally
been deleted, we'll avoid problems in that case here by treating Removed
attributes as ignored for the purposes of ImportStateVerify.

This required exporting some functionality that was formerly unexported
in helper/schema, but it's a relatively harmless schema introspection
function so shouldn't be a big deal to export it.
2019-04-16 11:14:49 -07:00
Martin Atkins c94f8f9067 website: Document division behavior change in v0.12 upgrade guide
The division operator now always performs floating point division, whereas
before it would choose between float and int division based on the types
of its arguments.

We have a specific error message for when a fractional number is used as
an index in HCL, but this additional upgrade guidance provides a specific
solution to the problem: the floor function.

Sadly we don't have enough context in the current design of the upgrade
tool to make this fix automatic. With some refactoring it may be possible
to apply the fix automatically within list brackets, but since that is
a relatively complex change we'll first try this manual solution prompted
by an error message, because in practice so far we've seen this reported
only in the context of list indexing and our error check will catch that
and make the user aware of the need for a fix there.
2019-04-16 10:03:37 -07:00
Martin Atkins 6a156f67ce vendor: go get github.com/hashicorp/hcl2@master
This includes a new specialized error message for when a fractional number
is used to index a sequence.
2019-04-16 10:03:37 -07:00