Commit Graph

22765 Commits

Author SHA1 Message Date
Martin Atkins 8c01cf7293 lang/funcs: Fix broken test for lookup function
When the value we're looking in has an object type, we need to know the
key in order to decide the result type. Therefore an object lookup with
an unknown key must produce cty.DynamicVal, not an unknown value with a
known type.
2018-11-06 08:33:49 -08:00
Martin Atkins 8f578c365f lang/funcs: Permit object types in the "length" function
The implementation already allowed this, so this was just an oversight in
the type checking function.

This fixes #19278.
2018-11-06 08:33:49 -08:00
Radek Simko c795302ab2
Update CHANGELOG.md 2018-11-06 11:19:34 +00:00
Radek Simko 7eae051a16
Merge pull request #19286 from hashicorp/radeksimko/b-timeouts-parsing-fix
helper/schema: Fix timeout parsing during Provider.Diff
2018-11-06 11:18:31 +00:00
Martin Atkins 5b6eee7613
Update CHANGELOG.md 2018-11-05 16:35:50 -08:00
Martin Atkins 3b723dd4d1
Truncate CHANGELOG back to v0.9.0
The changelog is getting too long for convenient browsing and editing, so here we cut it off at the v0.9 series and link to the rest of the history via the v0.8.8 tag.
2018-11-05 16:34:51 -08:00
Martin Atkins 421462cb64
Merge #19237: Handle unknown values properly in module outputs
Since the state models can't preserve unknown values, we need to rely on the plan to persist these until the effective configuration can be fully resolved during the apply phase.
2018-11-05 16:30:39 -08:00
Martin Atkins ab62b330c1 core: Allow planned output changes to be updated during apply
If plan and apply are both run against the same context then we still have
the planned output values in memory while we're doing the apply walk, so
we need to make sure to update them along with the state as we learn the
final known values of each output.

There were actually two different bugs here:

- We weren't removing any existing planned change for an output when
  setting a new one. In retrospect a map would've been a better data
  structure for the output changes, rather than a slice to mimic what we
  do for resource instance objects, but for now we'll leave the structures
  alone and clean up as needed. (The set of outputs should be small for
  any reasonable configuration, so the main impact of this is some ugly
  code in RemoveOutputChange.)

- RemoveOutputChange itself had a bug where it was iterating over the
  resource changes rather than the output changes. This didn't matter
  before because we weren't actually using that function, but now we are.

This fix is confirmed by restoring various existing context apply tests
back to passing again.
2018-11-05 16:02:45 -08:00
Sander van Harmelen 37687b8d6f
Merge pull request #19288 from hashicorp/f-variable-sources
Add a VariableSourceType for names .tfvars files
2018-11-05 20:22:47 +01:00
Sander van Harmelen b62a22ab62 Add a VariableSourceType for names .tfvars files
This new source type should be used for variables loaded from .tfvars files that were explicitly passed as command line arguments (e.g. -var-file=foo.tfvars)
2018-11-05 19:29:34 +01:00
Sander van Harmelen ca18d677a9
Merge pull request #19281 from hashicorp/b-remote-state
Do not clear out a previous set state when refreshing
2018-11-05 17:00:01 +01:00
Radek Simko 1cb8f1df80
helper/schema: Fix timeout parsing in ResourceTimeout.ConfigDecode 2018-11-05 12:42:12 +00:00
Radek Simko 82a77f9bb5
helper/schema: Add test for invalid timeout value 2018-11-05 12:42:12 +00:00
Radek Simko 2fe3f16cb3
helper/schema: Return error on invalid timeout type 2018-11-05 12:42:11 +00:00
Radek Simko 186a6dcc38
helper/schema: Add test for wrong timeout type 2018-11-05 12:42:11 +00:00
Sander van Harmelen a7b8cc8fe3 Do not clear out a previous set state when refreshing
In the case when no state existed remotely and a new one was created locally, we don’t want to blow away the new local state when refreshing.
2018-11-05 11:25:34 +01:00
Sean Carolan b7cf7737f6 website: use a clearer header describing the CLI config file (#19263)
Using a / could be confusing to users who assume it is a directory.
2018-11-02 17:26:52 -07:00
Sander van Harmelen f4cdb9945b
Merge pull request #19267 from hashicorp/f-module-depth
Remove support for the -module-depth flag
2018-11-02 20:16:40 +01:00
Sander van Harmelen 178ec8f7b4 Remove support for the -module-depth flag
# Conflicts:
#	backend/backend.go
2018-11-02 18:44:04 +01:00
James Bardin 47d5d62bdb update CHANGELOG.md 2018-11-02 11:26:23 -04:00
James Bardin 63c81ccff1
Merge pull request #19253 from hashicorp/jbardin/legacy-set-diff
don't apply unchanged attributes from legacy diffs
2018-11-02 11:18:01 -04:00
Martin Atkins 21577a5f15 core: Whole-module evaluation must consider planned output values
Just as when we resolve single output values we must check to see if there
is a planned new value for an output before using the value in state,
because the planned new value might contain unknowns that can't be
represented directly in the state (and would thus be incorrectly returned
as null).
2018-11-01 17:41:35 -07:00
Martin Atkins bbf8dacac8 plans: OutputChange.Encode must preserve Addr field 2018-11-01 17:33:10 -07:00
Martin Atkins d73b2d778f core: TestContext2Plan_requiredModuleOutput to use t.Run
This allows us to see the results of the tests for all resources even if
one of them fails.
2018-11-01 17:32:30 -07:00
James Bardin 7e4f09c787 don't apply unchanged attributes from legacy diffs
If a legacy diff has equal old and new values, don't apply the diff.
These would show up in sets, because of the overall change in set key.
2018-11-01 16:19:17 -04:00
James Bardin e91f381cc4 test case for optional bools in schema
Booleans in the legacy form were stored as strings, and can appear as
the incorrect type in the new type system.

Unset fields in sets also might show up erroneously in diffs, with
equal old and new values.
2018-11-01 16:19:03 -04:00
Sander van Harmelen d50008a126
Update CHANGELOG.md 2018-11-01 20:22:37 +01:00
Sander van Harmelen 643fccc923
Merge pull request #19250 from hashicorp/f-inputs
Fix the ability to ask for and save user input
2018-11-01 20:14:52 +01:00
Sander van Harmelen 5944e8e34f Fix the ability to ask for and save user input 2018-11-01 20:00:08 +01:00
Sander van Harmelen b648da2636
Merge pull request #19200 from hashicorp/f-state-show
command/state: update and fix the state show command
2018-11-01 19:24:07 +01:00
James Bardin ae1f93a24f
Merge pull request #19236 from hashicorp/jbardin/resource-tests
skip resource tests for now
2018-11-01 11:52:50 -04:00
James Bardin e74f46d622
Merge pull request #19233 from hashicorp/jbardin/requires-new
fix instance replacement
2018-11-01 11:52:08 -04:00
Chris Griggs 889841be76
Merge pull request #19238 from cgriggs01/cgriggs01-community
[Website] More Community Provider
2018-10-31 15:56:10 -07:00
cgriggs01 06a74a2dac fixit 2018-10-31 14:33:22 -07:00
cgriggs01 56a16e57a9 another provider and edit 2018-10-31 14:25:30 -07:00
cgriggs01 46c36b5e72 adding two community 2018-10-31 13:53:22 -07:00
James Bardin 21064771ea add failing test for required output value
The required value from an output is nil when it should be unknown
2018-10-31 16:41:36 -04:00
James Bardin a5ef403dfd skip resource tests for now
These aren't going to be fixed in the immediate future, and are
preventing the CI tests from being helpful.
2018-10-31 14:17:23 -04:00
James Bardin c9e7346bfd create a new proposed value when replacing
When replacing an instance, calculate a new proposed value from the null
state and the config. This ensures that all unknown values are properly
set.
2018-10-31 13:49:04 -04:00
James Bardin 4635ebc61a create a new proposed value when replacing
When replacing an instance, calculate a new proposed value from the null
state and the config. This ensures that all unknown values are properly
set.
2018-10-31 13:48:13 -04:00
James Bardin 718a3c400a fix state variable name 2018-10-31 13:43:50 -04:00
James Bardin 8212a6a9d0 add provider tests for force-new with a map
Adding and removing a single map that requires a new resource can cause
empty diffs, relying on the core proposed state values for destruction.
2018-10-31 13:42:28 -04:00
James Bardin f959b560a2 trim index steps from RequiresNew paths
Only GetAttrSteps can actually trigger RequiresNew, but the flatmaps
paths will point to the indexed value that caused the change.
2018-10-31 13:40:01 -04:00
Ubuntu af50f0e228 changelog: clean up after v0.12.0-alpha2 release 2018-10-31 01:07:43 +00:00
James Bardin 6383ffc2aa
Merge pull request #19226 from hashicorp/jbardin/no-diff
prefer prior state when there is no plan diff
2018-10-30 17:10:31 -04:00
James Bardin e0ea2a5d06 if there is no plan diff, prefer the prior state
The prior state may contain customizations made by the provider. If
there is no prior state, then take the proposed state.
2018-10-30 15:58:00 -04:00
James Bardin 28a881a670
Merge pull request #19222 from hashicorp/jbardin/timeout
provider timeouts
2018-10-30 14:56:59 -04:00
James Bardin 36cede09f7 add provider tests for SuppressDiffFunc 2018-10-30 14:53:38 -04:00
James Bardin f153720a36 add checks for timeouts attributes and blocks
Don't overwrite anything the provider defined, in order to maintain
existing behavior.

Change strings to pre-defined constants
2018-10-30 14:16:44 -04:00
James Bardin e38a5a769d copy timouts into plan and apply state
helper/schema will remove "timeouts" from the config, and stash them in
the diff.Meta map. Terraform sees "timeouts" as a regular config block,
so needs them to be present in the state in order to not show a diff.

Have the GRPCProviderServer shim copy all timeout values into any state
it returns to provide consistent diffs in core.
2018-10-30 13:14:08 -04:00