Commit Graph

27 Commits

Author SHA1 Message Date
Radek Simko 641b701830 schema: Make validation more strict 2015-10-03 14:29:19 -07:00
Paul Hinze 7eb72e7a12 helper/schema: record schema version when destroy fails
This was just a missed exit from the resource.Apply function -
subsequent refreshes would add the SchemaVersion back into the state,
but having the state recorded once without the meta information can
cause problems with Atlas's remote state checksumming.
2015-08-03 15:53:15 -05:00
Mitchell Hashimoto dd24ed4b76 helper/schema: blank ID refresh doesn't exist [GH-1905] 2015-05-13 20:15:13 -07:00
Paul Hinze 1e3d1b07e6 helper/schema: validate ConflictsWith against top-level
The runtime impl of ConfictsWith uses Resource.Get(), which makes it
work with any other attribute of the resource - the InternalValidate was
only checking against the local schemaMap though, preventing subResource
from using ConflictsWith properly.

It's a lot of wiring and it's a bit ugly, but it's not runtime code, so
I'm a bit less concerned about that aspect.

This should take care of the problem mentioned in #1909
2015-05-12 09:45:15 -05:00
Paul Hinze 66dbf91ffd helper/schema: ensure ForceNew set when Update is not
If a given resource does not define an `Update` function, then all of
its attributes must be specified as `ForceNew`, lest Applys fail with
"doesn't support update" like #1367.

This is something we can detect automatically, so this adds a check for
it when we validate provider implementations.
2015-04-03 09:57:30 -05:00
Paul Hinze 3ba8ed536b helper/schema: record schema version on apply
We were previously only recording the schema version on refresh. This
caused the state to be incorrectly written after a `terraform apply`
causing subsequent commands to run the state through an unnecessary
migration.
2015-03-18 19:08:48 -05:00
Paul Hinze 3d4b55e557 helper/schema: schema versioning & migration
Providers get a per-resource SchemaVersion integer that they can bump
when a resource's schema changes format. Each InstanceState with an
older recorded SchemaVersion than the cureent one is yielded to a
`MigrateSchema` function to be transformed such that it can be addressed
by the current version of the resource's Schema.
2015-03-06 16:26:11 -06:00
Mitchell Hashimoto 48b9614556 helper/schema: Exists API 2015-01-10 15:39:29 -08:00
Mitchell Hashimoto d0ce67a5b7 helper/schema: on destroy/create, reset state to be empty [GH-464] 2014-10-21 00:28:53 -07:00
Mitchell Hashimoto 9b2b3a963f ResourceDiff => InstanceDiff 2014-09-17 16:33:24 -07:00
Mitchell Hashimoto 81d9d70296 helper/schema: conforms to new API, tests pass 2014-09-16 17:07:13 -07:00
Mitchell Hashimoto c9a541d95b helper/schema: generate a full diff in destroy/create cycle 2014-08-27 15:45:52 -07:00
Mitchell Hashimoto 0c9b65f3f4 helper/schema: documentation 2014-08-26 21:52:09 -07:00
Mitchell Hashimoto 40e5608fa9 helper/schema: return the prior state if Data is an error 2014-08-26 15:50:31 -07:00
Mitchell Hashimoto 37cf52fa27 helper/schema: if no ID is set then return nil 2014-08-21 22:19:33 -07:00
Mitchell Hashimoto 5fc41cc272 helper/schema: properly put "id" into attributes 2014-08-20 10:38:51 -07:00
Mitchell Hashimoto 021a23fe99 helper/schema: if update sets the ID to blank, it deletes the resource 2014-08-20 10:38:51 -07:00
Mitchell Hashimoto 2444986fe8 helper/schema: nice error if update isn't supported 2014-08-19 09:26:48 -07:00
Mitchell Hashimoto c418681cc3 helper/schema: create/update/delete should work for Resource 2014-08-17 20:20:11 -07:00
Mitchell Hashimoto 894187ec18 helper/schema: Resource.Refresh 2014-08-17 19:45:26 -07:00
Mitchell Hashimoto 51a44db6c2 helper/schema: move InternalValidate to schemaMap 2014-08-17 14:50:44 -07:00
Mitchell Hashimoto a33e4bcdf0 helper/schema: properly validate sub-resources 2014-08-17 14:33:54 -07:00
Mitchell Hashimoto 7bc0be4b81 helper/schema: couple more tests around Computed (+ fix) 2014-08-16 09:49:22 -07:00
Mitchell Hashimoto 4af387b986 helper/schema: validation 2014-08-15 22:00:16 -07:00
Mitchell Hashimoto 31067ee8f6 helper/schema: ResourceData, starting tests 2014-08-15 16:32:43 -07:00
Mitchell Hashimoto 7f14708e71 helper/schema: list ForceNew 2014-08-14 23:32:20 -07:00
Mitchell Hashimoto 01b6b5f48e helper/schema: initial work 2014-08-13 14:23:22 -07:00