* provider/aws: Add errcheck to Makefile, error on unchecked errors
* more exceptions
* updates for errcheck to pass
* reformat and spilt out the ignore statements
* narrow down ignores
* fix typo, only ignore Close and Write, instead of close or write
The timeout was increased to 40 minutes when creating a new cluster in https://github.com/hashicorp/terraform/pull/8052. However when creating a cluster from a snapshot the timeout is still 15 minutes. I've increased this to 40 minutes.
The librator provider is sometimes throwing errors when trying to delete
a space that is already deleted. The nightly tests shows this error:
```
Error: Error applying: 1 error(s) occurred:
* librato_space.foobar: Error deleting space: DELETE
* https://metrics-api.librato.com/v1/spaces/236303: 404
* Request errors: Not Found,.
```
The Delete func should be aware if the space cannot be deleted as it is
already deleted and not error on this usecase
```
% make testacc TEST=./builtin/providers/librato TESTARGS='-run=Test'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/09/01 09:24:21 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/librato -v -run=Test -timeout 120m
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN TestAccLibratoAlert_Basic
--- PASS: TestAccLibratoAlert_Basic (1.52s)
=== RUN TestAccLibratoAlert_Full
--- PASS: TestAccLibratoAlert_Full (2.89s)
=== RUN TestAccLibratoAlert_Updated
--- PASS: TestAccLibratoAlert_Updated (1.76s)
=== RUN TestAccLibratoService_Basic
--- PASS: TestAccLibratoService_Basic (2.09s)
=== RUN TestAccLibratoService_Updated
--- PASS: TestAccLibratoService_Updated (2.73s)
=== RUN TestAccLibratoSpaceChart_Basic
--- PASS: TestAccLibratoSpaceChart_Basic (5.08s)
=== RUN TestAccLibratoSpaceChart_Full
--- PASS: TestAccLibratoSpaceChart_Full (13.06s)
=== RUN TestAccLibratoSpaceChart_Updated
--- PASS: TestAccLibratoSpaceChart_Updated (5.90s)
=== RUN TestAccLibratoSpace_Basic
--- PASS: TestAccLibratoSpace_Basic (4.29s)
PASS
ok github.com/hashicorp/terraform/builtin/providers/librato 39.321s
```
This commit adds a new callback, DiffSuppressFunc, to the schema.Schema
structure. If set for a given schema, a callback to the user-supplied
function will be made for each attribute for which the default
type-based diff mechanism produces an attribute diff. Returning `true`
from the callback will suppress the diff (i.e. pretend there was no
diff), and returning false will retain it as part of the plan.
There are a number of motivating examples for this - one of which is
included as an example:
1. On SSH public keys, trailing whitespace does not matter in many
cases - and in some cases it is added by provider APIs. For
digitalocean_ssh_key resources we previously had a StateFunc that
trimmed the whitespace - we now have a DiffSuppressFunc which
verifies whether the trimmed strings are equivalent.
2. IAM policy equivalence for AWS. A good proportion of AWS issues
relate to IAM policies which have been "normalized" (used loosely)
by the IAM API endpoints. This can make the JSON strings differ
from those generated by iam_policy_document resources or template
files, even though the semantics are the same (for example,
reordering of `bucket-prefix/` and `bucket-prefix/*` in an S3
bucket policy. DiffSupressFunc can be used to test for semantic
equivalence rather than pure text equivalence, but without having to
deal with the complexity associated with a full "provider-land" diff
implementation without helper/schema.