Commit Graph

39 Commits

Author SHA1 Message Date
James Bardin
cba592d54f minor race issue in mockResourceProvider
The interrupt tests for providers no longer check for the condition
during the diff operation. defer the lock so other test's DiffFns don't
need to be as carefull locking themselves.
2017-12-20 09:18:38 -05:00
James Bardin
df38c2e3ea make the mock provider stoppable
The mock provider couldn't be stopped during diff, because the single
mutex was held through the oepration. Release the mutex so Stop can be
called.
2017-12-05 10:17:20 -05:00
Martin Atkins
183833affc core: terraform.ResourceProvider.GetSchema method
In order to parse provider, resource and data source configuration from
HCL2 config files, we need to know the relevant configuration schema.
This new method allows Terraform Core to request these from a provider.

This is a breaking change to this interface, so all of its implementers
in this package are updated too. This includes concrete implementations
of the new method in helper/schema that use the schema conversion code
added in an earlier commit to produce a configschema.Block automatically.

Plugins compiled against prior versions of helper/schema will not have
support for this method, and so calls to them will fail. Callers of
this new method will therefore need to sniff for support using the
SchemaAvailable field added to both ResourceType and DataSource.

This careful handling will need to persist until next time we increment
the plugin protocol version, at which point we can make the breaking
change of requiring this information to be available.
2017-10-17 07:23:41 -07:00
James Bardin
db6ef69e5b fix race in MockResourceProvider
Input can be called concurrently from multiple nodes in the graph.
2017-08-16 15:19:17 -04:00
Mitchell Hashimoto
d338a1ef88
terraform: implement Stop in the mock and shadow 2016-10-25 12:08:35 -07:00
Mitchell Hashimoto
60140b28f4
Revert "Merge pull request #9536 from hashicorp/f-provider-stop"
This reverts commit c3a4cff133, reversing
changes made to 791a02e6e4.

This change requires plugin recompilation and we should hold off until a
minor release for that.
2016-10-25 12:00:36 -07:00
Mitchell Hashimoto
7e2582c47b
terraform: implement Stop in the mock and shadow 2016-10-25 11:31:55 -07:00
Mitchell Hashimoto
e2c415a87e
terraform: resource provider must never return pointers to same data
This is a requirement for the parallelism of Terraform to work sanely.
We could deep copy every result but I think this would be unrealistic
and impose a performance cost when it isn't necessary in most cases.
2016-10-17 20:55:20 -07:00
Martin Atkins
0e0e3d73af core: New ResourceProvider methods for data resources
This is a breaking change to the ResourceProvider interface that adds the
new operations relating to data sources.

DataSources, ValidateDataSource, ReadDataDiff and ReadDataApply are the
data source equivalents of Resources, Validate, Diff and Apply (respectively)
for managed resources.

The diff/apply model seems at first glance a rather strange workflow for
read-only resources, but implementing data resources in this way allows them
to fit cleanly into the standard plan/apply lifecycle in cases where the
configuration contains computed arguments and thus the read must be deferred
until apply time.

Along with breaking the interface, we also fix up the plugin client/server
and helper/schema implementations of it, which are all of the callers
used when provider plugins use helper/schema. This would be a breaking
change for any provider plugin that directly implements the provider
interface, but no known plugins do this and it is not recommended.

At the helper/schema layer the implementer sees ReadDataApply as a "Read",
as opposed to "Create" or "Update" as in the managed resource Apply
implementation. The planning mechanics are handled entirely within
helper/schema, so that complexity is hidden from the provider implementation
itself.
2016-05-14 08:26:36 -07:00
Mitchell Hashimoto
ec02c8c0e2
helper/resource: testing of almost all aspects of ImportState tests 2016-05-11 13:02:37 -07:00
Mitchell Hashimoto
d1a81379d0
terraform: use InstanceInfo more appropriately, pass ID to ImportState 2016-05-11 13:02:35 -07:00
Mitchell Hashimoto
531f609564
terraform: add ImportState to the provider interface 2016-05-11 13:02:30 -07:00
Paul Hinze
715437537d command: fix flaky parallelism tests
Thanks to @mitchellh for helping sort out concurrency stuff here.
2015-10-29 15:16:34 -05:00
Mitchell Hashimoto
d6f7261190 terraform: provider mock should close itself to find bugs 2015-06-29 10:33:37 -07:00
Sander van Harmelen
83c760fcb3 core: refactoring the way sets work internally v2
This is a refactored solution for PR #616. Functionally this is still
the same change, but it’s implemented a lot cleaner with less code and
less changes to existing parts of TF.
2014-12-12 23:21:20 +01:00
Mitchell Hashimoto
2791badf01 terraform: ask for input for providers 2014-09-29 09:13:15 -07:00
Mitchell Hashimoto
5611b9b8a8 terraform: add Input API to ResourceProvider 2014-09-28 23:50:37 -07:00
Mitchell Hashimoto
c88614c585 terraform: providers inherit properly for validation 2014-09-24 21:38:23 -07:00
Mitchell Hashimoto
8dbc7e0ccb terraform: change the graph a bit to better support providers with
modules

This doesn't cause inheritence to work yet. That is coming
2014-09-24 13:31:35 -07:00
Mitchell Hashimoto
9b2b3a963f ResourceDiff => InstanceDiff 2014-09-17 16:33:24 -07:00
Mitchell Hashimoto
95f3e626a5 terraform: modify the ResourceProvider API super hardcore 2014-09-16 16:20:11 -07:00
Mitchell Hashimoto
8d065ce5c4 terraform: don't validate orphans 2014-07-11 11:09:19 -07:00
Mitchell Hashimoto
ac0e29e98e terraform: races in MockResourceProvider 2014-07-10 13:38:04 -07:00
Mitchell Hashimoto
d0577fda02 terraform: add ValidateResource API to ResourceProvider 2014-07-02 20:35:03 -07:00
Mitchell Hashimoto
dc193f5f33 terraform: call refresh before every diff
In the future, we'll make this a separate thing...
2014-06-19 21:22:07 -07:00
Mitchell Hashimoto
b3e20a3e85 terraform: basic apply, more tests needed 2014-06-18 15:35:03 -07:00
Mitchell Hashimoto
8a2eb95a42 terraform: Validate called on provider 2014-06-12 22:30:09 -07:00
Mitchell Hashimoto
7e421dd89b terraform: ResourceConfig 2014-06-12 17:59:59 -07:00
Mitchell Hashimoto
02a3603a9a rpc: Diff implementation 2014-06-06 00:48:32 -07:00
Mitchell Hashimoto
0561edc2fd terraform: check for errors initializing a provider 2014-06-06 00:28:57 -07:00
Mitchell Hashimoto
796dfd54e9 terraform: just hardcode a UUID in there for computed placeholders 2014-06-05 20:03:16 -07:00
Mitchell Hashimoto
9018beda81 terraform: placeholder key for computed values 2014-06-05 11:30:48 -07:00
Mitchell Hashimoto
d77a72ba84 terraform: take into account dependency variables in diffs 2014-06-05 07:27:01 -07:00
Mitchell Hashimoto
7c6920bba1 terraform: diff/state work better together, merge 2014-06-05 06:57:06 -07:00
Mitchell Hashimoto
e904fca3da terraform: Diff! 2014-06-05 02:32:10 -07:00
Mitchell Hashimoto
9480783ee4 terraform: add Diff to ResourceProvider
rpc and plugin don't compile yet
2014-06-03 16:42:21 -07:00
Mitchell Hashimoto
c9d8413431 terraform: New happy path works decently well 2014-06-03 15:08:00 -07:00
Mitchell Hashimoto
0c1a341d90 terraform: Resources method for providers 2014-06-03 14:26:31 -07:00
Mitchell Hashimoto
f8dc3286d9 rpc: ResourceProvider over RPC 2014-05-28 15:07:47 -07:00