Commit Graph

22729 Commits

Author SHA1 Message Date
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
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 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 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 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
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
James Bardin 121c9c127f add timeout tests to the test provider 2018-10-30 13:14:08 -04:00
James Bardin 6dad121e70 insert resource timeouts into the config schema
Resource timeouts were a separate config block, but did not exist in the
resource schema. Insert any defined timeouts when generating the
configshema.Block so that the fields can be accepted and validated by
core.
2018-10-30 13:14:08 -04:00
Nick Fagerlund ab88f8ca0f
website: Update and link the page about remote backend operations (#19203) 2018-10-29 11:00:24 -07:00
Kristin Laemmert b2f7da05c8
Merge pull request #19212 from hashicorp/mildwonkey/docs/backend-local
website: update terraform_remote_state syntax in backend docs
2018-10-29 10:41:05 -07:00
Kristin Laemmert 5fa624c55e website: update terraform_remote_state syntax in backend docs 2018-10-29 09:22:21 -07:00
Sander van Harmelen 2b075bbf8e
Update CHANGELOG.md 2018-10-27 15:21:42 +02:00
Sander van Harmelen 292ec47e66
Merge pull request #19197 from hashicorp/f-state-mv
command/state: update and fix the state mv command
2018-10-27 15:03:42 +02:00
Sander van Harmelen 7ec3f96e3a command/state: update and fix the state mv command 2018-10-27 15:01:07 +02:00
Kristin Laemmert 009534d101
Merge pull request #18039 from outsideris/update-idna
Add test to verify terraform can handle hostname that starts with numeric chars
2018-10-26 14:33:22 -07:00
James Bardin 6172d0e744
Merge pull request #19201 from hashicorp/jbardin/shims
missed IsNull check in config shim
2018-10-26 13:54:23 -07:00
James Bardin a1915964a2 some basic tests for NewResourceConfigShimmed
This is used in the helper package for the provider shims.
2018-10-26 15:01:30 -04:00
James Bardin 6732b6713b missed IsNull check in config shim 2018-10-26 14:02:09 -04:00
Sander van Harmelen c7c6f6efba
Restore the older CHANGELOG entries 2018-10-26 15:05:44 +02:00
Brian Flad 0ece7b9165
Update CHANGELOG for #19190 2018-10-25 12:22:57 -07:00
Brian Flad a8adfeb008
Merge pull request #19190 from hashicorp/v-terraform-provider-aws-v1.41.0
deps: terraform-providers/terraform-provider-aws@v1.41.0 and aws/aws-sdk-go@v1.15.55
2018-10-25 12:19:04 -07:00
Outsider a2cb579d1b
svchost: test for hostname started with numeric
Signed-off-by: Outsider <outsideris@gmail.com>
2018-10-25 09:02:28 -07:00
Radek Simko b54cc1d95f
Merge pull request #19170 from mikesir87/patch-1
Small grammar fix for lifecycle docs
2018-10-25 08:51:57 +02:00
Radek Simko b1abb3de8e
Merge pull request #19169 from hgontijo/patch-1
Fix typo.
2018-10-25 08:49:27 +02:00
Brian Flad 2c59de064b
deps: terraform-providers/terraform-provider-aws@v1.41.0 and aws/aws-sdk-go@v1.15.55
Provides the ability for the S3 backend to read `credential_source` via AWS configuration file.
2018-10-24 21:14:30 -07:00
Alisdair McDiarmid 2e480bb17c Add links to new screenshots (#19135)
Screenshots for:

- GitHub Pull Request with resource changes in the TFE status update
- TFE plan-only run for a Pull Request
2018-10-24 15:20:43 -07:00
Sander van Harmelen cb5574800f
Update CHANGELOG.md 2018-10-24 20:44:41 +02:00
Sander van Harmelen 9db93523bf
Merge pull request #19178 from hashicorp/f-state-rm
command/state: update and fix the state rm command
2018-10-24 20:10:38 +02:00
Sander van Harmelen 19c1241a50 command/state: update and fix the state rm command 2018-10-24 10:59:33 +02:00
Radek Simko 1577704bdf
Update CHANGELOG.md 2018-10-23 20:44:32 +02:00
Radek Simko 1de7c5849d
Merge pull request #19161 from hashicorp/b-lookup-crash-fix
lang: Fix crash in lookup function
2018-10-23 20:19:45 +02:00
Sander van Harmelen 4a2cbb3562
Update CHANGELOG.md 2018-10-23 17:57:52 +02:00
Radek Simko b41cda7d7a
Return cty.DynamicPseudoType instead 2018-10-23 12:42:46 +02:00
Michael Irwin 47047aa637
Small grammar fix for lifecycle docs 2018-10-22 22:34:11 -04:00
Henrique M. Gontijo 642cdd331f
Fix typo. 2018-10-22 14:26:33 -07:00
Radek Simko 4856d81300
lang: Fix crash in lookup function 2018-10-22 12:58:47 +02:00
Martin Atkins 1dc3e50c47
CHANGELOG: Clean up after v0.12.0-alpha1 release 2018-10-19 17:45:54 -07:00
Martin Atkins a3e601d45d
CHANGELOG: Replace some specific enumerated 0.12-alpha1 known issues with a link to GitHub issues 2018-10-19 17:40:44 -07:00
James Bardin dbaf347392
Merge pull request #19136 from hashicorp/jbardin/simple-diff
panic fixes
2018-10-19 17:06:37 -04:00
James Bardin e93d69f18b more nil/known checks before val.LengthInt 2018-10-19 16:51:15 -04:00
Brian Flad 62bf23850b
Merge pull request #19122 from hashicorp/f-helper-validation-Any
helper/validation: Add Any() SchemaValidateFunc
2018-10-19 15:11:33 -04:00