Commit Graph

21342 Commits

Author SHA1 Message Date
James Bardin 88e911af45 fix a provisionerFail test which was incorrect
The provisionerFail_createBeforeDestroy test was verifying the incorrect
output. The create_before_destroy instance in the state has an ID of
"bar" with require_new="abc", and a new instance would get an ID of
"foo" with require_new="xyz". The existing test was expecting the
following state:

aws_instance.bar: (1 deposed)
  ID = bar
  provider = provider.aws
  require_new = abc
  Deposed ID 1 = foo (tainted)

Which showed "bar" still the primary instance in the state, with the new
instance "foo" as being the deposed instance, though properly tainted.

The new output is:

aws_instance.bar: (tainted) (1 deposed)
  ID = foo
  provider = provider.aws
  require_new = xyz
  type = aws_instance
  Deposed ID 1 = bar

Showing the new "foo instance as being the primary instance in the
state, with "bar" as the deposed instance.
2018-03-15 16:04:05 -04:00
James Bardin b2d111c2bd return provisioner Apply errors
EvaApplyProvisioners was not returning errors if there was already a
multierror stored in the Error field. Always return the error to the
caller.
2018-03-15 16:04:05 -04:00
James Bardin a1061ed931 update the chef and habitat error handling
Use the new ExitStatus method, and also check the cmd.Err() method for
errors.

Remove leaks from the output goroutines in both provisioners by
deferring their cleanup, and returning early on all error conditions.
2018-03-15 16:04:05 -04:00
James Bardin a715430d24 fix exit status handling in salt-masterless
Convert to the new Cmd.ExitStatus() method in the salt-masterless
provisioner. Add calls to Wait and remove race conditions around setting
the status.
2018-03-15 16:04:00 -04:00
James Bardin b214834834 update the vendored winrm release
This was updated to see if we can get at any error status from the
remote command and transport, which still is not available, but kept the
latest version since it fixes a couple race conditions.
2018-03-15 16:03:40 -04:00
James Bardin af132a186d remove timeout from remote-exec command context
The timeout for the remote command was taken from the wrong config
field, and the connection timeout was being used which is 5 min. Any
remote command taking more than 5 min would be terminated by
disconnecting the communicator. Remove the timeout from the context, and
rely on the global timeout provided by terraform.

There was no way to get the error from the communicator previously, so
the broken connection was silently ignored and the provisioner returned
successfully. Now we can use the new cmd.Err() method to retrieve any
errors encountered during execution.
2018-03-15 16:03:40 -04:00
James Bardin 2d7dc605a0 get communicator errors from a remote.Cmd
The remote.Cmd struct could not convey any transport related error to
the caller, meaning that interrupted commands would show that they
succeeded.

Change Cmd.SetExited to accept an exit status, as well as an error to
store for the caller.  Make the status and error fields internal,
require serialized access through the getter methods.

Users of remote.Cmd should not check both Cmd.Err() and Cmd.ExitStatus()
until after Wait returns.

Require communicators to call Cmd.Init before executing the command.
This will indicate incorrect usage of the remote.Cmd by causing a panic
in SetExitStatus.
2018-03-15 16:03:20 -04:00
Radek Simko 04899393b0
Update CHANGELOG.md 2018-03-14 18:54:22 +00:00
Radek Simko f6c3e40439
Merge pull request #17463 from hashicorp/b-helper-r-diff-nested-keys
helper/schema: Allow ResourceDiff.ForceNew on nested fields (avoid crash)
2018-03-14 18:53:44 +00:00
Brian Flad 2044f09bb4
Merge pull request #17585 from DeviaVir/patch-1
Fixing small typo in resource/wait.go
2018-03-14 13:23:44 -04:00
Chase 02ff60d083
Fixing small typo in resource/wait.go 2018-03-14 17:33:03 +01:00
Brian Flad 504d5ef233
Merge pull request #17572 from hashicorp/d-getting-started-resource-dependencies-bucket-name
docs/getting-started: Replace underscores in aws_s3_bucket name in dependencies example
2018-03-13 15:22:49 -04:00
Brian Flad 3833e507db
Merge pull request #17571 from hashicorp/d-docs-internal-remote-service-discovery-sidebar
docs/internal: Fix sidebar navigation for Remote Service Discovery page
2018-03-13 15:21:02 -04:00
Brian Flad 4e7c9dd07b docs/getting-started: Replace underscores in aws_s3_bucket name in dependencies example 2018-03-13 12:56:49 -04:00
Brian Flad 9b295e2bc7 docs/internal: Fix sidebar navigation for Remote Service Discovery page 2018-03-13 12:49:49 -04:00
James Bardin 69c323a9f4
Merge pull request #17561 from stack72/manta-backend
backend/manta: Manta Backend was not dealing with a ResourceNotFound
2018-03-13 11:51:01 -04:00
James Bardin 42ae8497e9
Merge pull request #17567 from stack72/dependecies-triton-go-1.1.1
backend/manta: Update triton-go dependency to 1.1.1
2018-03-13 11:50:49 -04:00
stack72 78525fd65a backend/manta: Update triton-go dependency to 1.1.1
This will support the features of RBAC in Manta Backends
2018-03-13 12:10:41 +02:00
Paul Tyng 9442c4b46e
Merge pull request #17551 from hashicorp/paultyng-patch-1
Export a const for validation methods
2018-03-12 19:06:04 -04:00
James Bardin cf887b08b7 update CHANGELOG.md 2018-03-12 15:54:26 -04:00
stack72 a6f76aa0af backend/manta: Manta Backend was not dealing with a ResourceNotFound
Fixes: #17314

We now deal correctly with the creation of the state file - we were
not dealing well with a ResourceNotFound error

Now that this has been changed around, we try and create the statefile
and if there is an error, we look for an existing statefile - previously
this was not the order of operations
2018-03-12 17:27:57 +02:00
Radek Simko 9cef4674c5
Merge pull request #17550 from lrakai/lrakai-patch-module-usage
Grammar Improvement
2018-03-12 10:56:11 +00:00
Paul Tyng 528cbecfce
Make failure message more explicit 2018-03-10 21:53:54 -05:00
Paul Tyng 707d7febe3
Use constants in test 2018-03-10 20:56:13 -05:00
Paul Tyng f18e4f2921
Export a const for validation methods 2018-03-10 12:40:37 -05:00
Logan Rakai 84637534f4
Grammar Improvement 2018-03-10 09:30:22 -07:00
Martin Atkins 557bc1a349
Update CHANGELOG.md 2018-03-09 17:06:49 -08:00
Martin Atkins c86a618c0a
Update CHANGELOG.md 2018-03-09 17:05:24 -08:00
James Bardin 95c39d0c0b
Merge pull request #17548 from hashicorp/jbardin/GH-17368
ignore errors interpolating RawCount during apply
2018-03-09 19:49:44 -05:00
James Bardin a2718e4f79 ignore errors interpolating RawCount during apply
If a count field references another count field which is interpolated
but is attached to a resource already in the state, the result of that
first interpolation will be lost when a plan is serialized. This is
because the result of the first interpolation is stored directly in the
module config, in an unexported config field.

This is not a general fix for the above situation, which would require
refactoring how counts are handles throughout the config. Ignoring the
error works, because in most cases the count will be properly
handled during the resource's interpolation.
2018-03-09 19:16:04 -05:00
James Bardin f3d1fb3aff failing test for interpolated count from plan
An interpolated count value that is determined during plan, is lost
during plan serialization, causing apply to fail when the interpolation
string can't be evaluated.
2018-03-09 19:04:39 -05:00
James Bardin bb8f859113
Merge pull request #17545 from hashicorp/jbardin/remote-state-environment
don't let default workspace override environment
2018-03-09 12:24:54 -05:00
James Bardin e011dd95f3 don't let default workspace override environment
The workspace attribute should only override the environment if it's not
the default value.
2018-03-09 10:27:06 -05:00
Martin Atkins 441e62748c
Update CHANGELOG.md 2018-03-08 18:06:18 -08:00
Martin Atkins b94da25919
Update CHANGELOG.md 2018-03-08 18:04:50 -08:00
Martin Atkins 6aefa5835c Merge #17218: Add -auto-approve to "terraform destroy" for consistency 2018-03-08 17:42:15 -08:00
Martin Atkins 5661ab5991 configs: allow full type constraints for variables
Previously we just ported over the simple "string", "list", and "map" type
hint keywords from the old loader, which exist primarily as hints to the
CLI for whether to treat -var=... arguments and environment variables as
literal strings or as HCL expressions.

However, we've been requested before to allow more specific constraints
here because it's generally better UX for a type error to be detected
within an expression in a calling "module" block rather than at some point
deep inside a third-party module.

To allow for more specific constraints, here we use the type constraint
expression syntax defined as an extension within HCL, which uses the
variable and function call syntaxes to represent types rather than values,
like this:
 - string
 - number
 - bool
 - list(string)
 - list(any)
 - list(map(string))
 - object({id=string,name=string})

In native HCL syntax this looks like:

    variable "foo" {
      type = map(string)
    }

In JSON, this looks like:

    {
      "variable": {
        "foo": {
          "type": "map(string)"
        }
      }
    }

The selection of literal processing or HCL parsing of CLI-set values is
now explicit in the model and separate from the type, though it's still
derived from the type constraint and thus not directly controllable in
configuration.

Since this syntax is more complex than the keywords that replaced it, for
now the simpler keywords are still supported and "list" and "map" are
interpreted as list(any) and map(any) respectively, mimicking how they
were interpreted by Terraform 0.11 and earlier. For the time being our
documentation should continue to recommend these shorthand versions until
we gain more experience with the more-specific type constraints; most
users should just make use of the additional primitive type constraints
this enables: bool and number.

As a result of these more-complete type constraints, we can now type-check
the default value at config load time, which has the nice side-effect of
allowing us to produce a tailored error message if an override file
produces an invalid situation; previously the result was rather confusing
because the error message referred to the original definition of the
variable and not the overridden parts.
2018-03-08 16:23:35 -08:00
Seth Vargo 12f8c90a51 website: Recommend SVG instead of PNG for graph output 2018-03-08 16:22:21 -08:00
Martin Atkins c05a1050fc configs: Disable deprecation warning for quoted keywords/references
Although we do still consider these deprecated for 0.12, we'll defer
actually generating warnings for them until a later minor release so that
module authors can retain their quoted identifiers for a period after 0.12
release for backward-compatibility with Terraform 0.11.
2018-03-08 15:42:47 -08:00
Martin Atkins a26ff56f01 configs: highlight resource name in diags when invalid
Previously we were erroneously highlighting the resource type name instead.
2018-03-08 15:41:19 -08:00
James Bardin f825a2118b
Merge pull request #17513 from hashicorp/jbardin/GH-17509
Check for nil config in node_resource_refresh
2018-03-08 18:12:13 -05:00
Martin Atkins 3cec7dc595
Merge #17533: Update "HCL2" and cty dependencies 2018-03-08 14:49:25 -08:00
Martin Atkins 7549ce15f0 configs: update values file invalid syntax test for new HCL behavior
The error-handling behavior of the HCL parser was improved, which causes
the number of diagnostics and the diagnostics messages to be different
in cases where a block-like introduction is given but without any
following body.
2018-03-08 11:17:39 -08:00
Martin Atkins 59a49c6b3f vendor: update hcl2 and cty
This is largely minor bugfixes for issues found since we last updated the
vendoring. There are some new features here that Terraform is not yet
using and thus present little risk.

In particular this includes the HCL-JSON spec change where arrays can now
be used at any level in a block label structure, to allow for preserving
the relative order of blocks.
2018-03-08 11:10:34 -08:00
James Bardin 5727d33352
Merge pull request #17531 from hashicorp/jbardin/null-output
filter null output values from state
2018-03-08 13:29:02 -05:00
James Bardin 13433687cb filter null output values from state
While null values should not normally appear in a state file, we should
filter the values rather than crash.
2018-03-08 11:39:29 -05:00
Paul Tyng a61b40c7a2
Merge pull request #17517 from ivanovteo/ivanovteo/docs-providers-small-typo
Trivial documentation fix
2018-03-07 11:15:23 -05:00
Andrei Ivanov 53110e5c1f - fixed a trivial typo 2018-03-07 17:57:25 +02:00
James Bardin 7fd6f97899 Check for nil config in node_resource_refresh
While not normally possible, manual manipulation of the state and config
can cause us to end up with a nil config in
evalTreeManagedResourceNoState.

Regardless of how it got here, we can't ever assume the Config field is
not nil, and EvalInterpolate happily accepts a nil RawConfig
2018-03-06 17:53:09 -05:00
Martin Atkins ea50f455ed
Update CHANGELOG.md 2018-03-05 16:00:19 -08:00