terraform/helper
Paul Hinze d59db52f06 helper/resource: Fix data race in resource.Retry
The implementation was attempting to capture the error using a scoped
variable reference, but the error value is already exposed via the
return value of `WaitForState()`. Using that instead fixes the data
race.

Fixes the following data race:

```
==================
WARNING: DATA RACE
Read by goroutine 74:
  github.com/hashicorp/terraform/helper/resource.Retry()
      /Users/phinze/go/src/github.com/hashicorp/terraform/helper/resource/wait.go:35 +0x284
  github.com/hashicorp/terraform/helper/resource.TestRetry_timeout()
      /Users/phinze/go/src/github.com/hashicorp/terraform/helper/resource/wait_test.go:35 +0x60
  testing.tRunner()
      /private/var/folders/vd/7l9ys5k57l91x63sh28wl_kc0000gn/T/workdir/go/src/testing/testing.go:456 +0xdc

Previous write by goroutine 90:
  github.com/hashicorp/terraform/helper/resource.Retry.func1()
      /Users/phinze/go/src/github.com/hashicorp/terraform/helper/resource/wait.go:20 +0x87
  github.com/hashicorp/terraform/helper/resource.(*StateChangeConf).WaitForState.func1()
      /Users/phinze/go/src/github.com/hashicorp/terraform/helper/resource/state.go:83 +0x284

Goroutine 74 (running) created at:
  testing.RunTests()
      /private/var/folders/vd/7l9ys5k57l91x63sh28wl_kc0000gn/T/workdir/go/src/testing/testing.go:561 +0xaa3
  testing.(*M).Run()
      /private/var/folders/vd/7l9ys5k57l91x63sh28wl_kc0000gn/T/workdir/go/src/testing/testing.go:494 +0xe4
  main.main()
      github.com/hashicorp/terraform/helper/resource/_test/_testmain.go:84 +0x20f

Goroutine 90 (running) created at:
  github.com/hashicorp/terraform/helper/resource.(*StateChangeConf).WaitForState()
      /Users/phinze/go/src/github.com/hashicorp/terraform/helper/resource/state.go:127 +0x283
  github.com/hashicorp/terraform/helper/resource.Retry()
      /Users/phinze/go/src/github.com/hashicorp/terraform/helper/resource/wait.go:34 +0x276
  github.com/hashicorp/terraform/helper/resource.TestRetry_timeout()
      /Users/phinze/go/src/github.com/hashicorp/terraform/helper/resource/wait_test.go:35 +0x60
  testing.tRunner()
      /private/var/folders/vd/7l9ys5k57l91x63sh28wl_kc0000gn/T/workdir/go/src/testing/testing.go:456 +0xdc
==================
```
2016-01-16 13:38:50 -05:00
..
acctest provider/google: enchance storage acctests to avoid collisions 2016-01-05 09:07:45 -06:00
config Fix failing tests 2014-10-09 21:29:21 -07:00
diff config: use new API 2015-01-14 22:03:15 -08:00
hashcode formatting, cleanups 2015-02-11 11:40:49 -08:00
logging core: use same logging setup for acctests 2015-12-08 17:50:36 -06:00
mutexkv provider/aws: serialize SG rule access to fix race condition 2015-11-18 12:39:59 -06:00
pathorcontents ssh: accept private key contents instead of path 2015-11-12 14:59:14 -06:00
resource helper/resource: Fix data race in resource.Retry 2016-01-16 13:38:50 -05:00
schema Merge pull request #3257 from fatih/fix-nil-setting-schema 2015-12-08 20:15:00 -06:00
README.md dos2unix 2014-07-28 10:43:00 -07:00

README.md

Helper Libraries

This folder contains helper libraries for Terraform plugins. A running joke is that this is "Terraform standard library" for plugins. The goal of the packages in this directory are to provide high-level helpers to make it easier to implement the various aspects of writing a plugin for Terraform.