Commit Graph

38 Commits

Author SHA1 Message Date
James Bardin
d905b990a5 s/GraphNodeResource/GraphNodeConfigResource/
Make the interface name reflect the new return type of the method.
Remove the confusingly named and unused ResourceAddress method from the
resource nodes as well.
2020-03-16 11:16:23 -04:00
Alex Pilon
4bf43efcfd
move hcl2shim package to configs 2019-08-06 19:58:58 -04:00
Alex Pilon
83aa07f907
prune NewResourceConfig and update tests 2019-08-05 22:08:03 -04:00
Alex Pilon
7f8f198719
remove UnknownVariabeValue from config and update references to shim 2019-07-17 22:41:24 -04:00
James Bardin
8250b2e4de more precise handling of ComputedKeys in config
With the new ConfigModeAttr, we can now have complex structures come in
as attributes rather than blocks. Previously attributes were either
known, or unknown, and there was no reason to descend into them. We now
need to record the complete path to unknown values within complex
attributes to create a proper diff after shimming the config.
2019-05-05 09:02:33 -04:00
James Bardin
43f0468829 fix ComputedKeys for nested blocks in shimmed cfg
The indexes were added out of order in the attribute keys
2019-05-02 14:08:40 -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
Martin Atkins
e3dad1bcc1 core: Drop InstanceInfo.HumanId
Our shims from new provider API to old can't populate the InstanceInfo
fully since the new API only includes the type name, and so anyone
depending on this method is now broken anyway.

In practice only our own tests depend on this, and so we'll drop it to
make it explicit that it no longer works (rather than having it return
nonsense) and then fix up the remaining tests that were depending on it
to use a different strategy.
2018-10-16 19:14:11 -07:00
Florian Forster
6680b1f16b core: check for negative indices in ResourceConfig.get
The bounds checking in ResourceConfig.get() was insufficient: it detected when the index was greater than or equal to cv.Len() but not when the index was less than zero. If the user provided an (invalid) configuration that referenced "foo.-1.bar", the provider would panic.

Now it behaves the same way as if the index were too high.
2017-12-12 09:18:38 -08:00
Martin Atkins
d4efc95191 command: show resource actions using resource addresses
Previously we were using the internal resource id syntax in the UI. Now
we'll use the standard user-facing resource address syntax instead.
2017-09-01 17:55:05 -07:00
James Bardin
16597d4a55 Nested lists and maps fail in GetRaw
When referencing a list of maps variable from within a resource, only
the first list element is included the plan. This is because GetRaw
can't access the interpolated values. Add some tests to document this
behavior for both Get and GetRaw.
2016-11-28 09:04:12 -05:00
James Bardin
8f6583c264 Add test for ResourceConfig.Get
ResourceConfig.Get could previously return (nil, true) when looking up
an interpolated map in a list because of the indexing ambiguity. Make
sure we test that a non-existent value always returns false.
2016-11-21 10:09:21 -05:00
Mitchell Hashimoto
9b5b122f14
terraform: ResourceConfig reimplementation for TypeUnknown
The primary change here is to expect that Config contains computed
values. This introduces `unknownCheckWalker` that does a really basic
reflectwalk to look for computed values and use that for IsComputed.

We had a weird mixture before checking whether c.Config was simply
missing values to determine where to look. Now we rely on IsComputed
heavily.
2016-11-09 14:28:16 -08:00
Mitchell Hashimoto
29485f6167
terraform: ResourceConfig.IsComputed cases 2016-11-09 14:28:15 -08:00
Mitchell Hashimoto
0c271b2b2d
terraform: better detection of unknown values in ResourceConfig, tests 2016-11-09 14:28:15 -08:00
Mitchell Hashimoto
9cc5e81a6c
terraform: add tests for IsComputed that pass on master 2016-11-09 14:28:15 -08:00
Mitchell Hashimoto
3dd64d9f2e
terraform: ResourceConfig.Equal should sort ComputedKeys
This was causing otherwise equal ResourceConfigs to report non-equal
which was incorrect, thus causing incorrect shadow graph errors.
2016-10-22 12:00:05 -07:00
Mitchell Hashimoto
30596ca371
terraform: sanity test (passes, always passed) 2016-10-11 22:17:31 +08:00
Mitchell Hashimoto
d37bb87bf2
terraform: ResourceConfig.DeepCopy should handle the nil case 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
f73dc844c7
wip 2016-10-11 22:17:27 +08:00
Mitchell Hashimoto
f897fa4701
terraform: ResourceConfig.Equal and tests 2016-09-27 18:52:32 -07:00
Mitchell Hashimoto
56901e5cfd
terraform: ResourceConfig.DeepCopy
This implements DeepCopy, still need to implement Equals to make this
more useful. Coming in the next commit but this still has its own full
functionality + tests.
2016-09-27 16:09:32 -07:00
James Bardin
87a5ce8045 Add tests for maps with dots
This adds some unit tests for config maps with dots in the key values.
We check for maps with keys which have overlapping names. There are
however still issues with nested maps which create overlapping flattened
names, as well as nested lists with dots in the key.
2016-07-20 14:08:14 -04:00
Mitchell Hashimoto
8be4afacf8 terraform: replace config/lang usage 2016-02-03 13:24:04 -05:00
Mitchell Hashimoto
e37c187228 terraform: goodbye context.go (old) 2015-02-19 12:08:32 -08:00
Mitchell Hashimoto
c2df70e499 terraform: complete more nodes 2015-02-19 12:07:54 -08:00
Mitchell Hashimoto
ea18b62e8f terraform: count.index 2014-10-02 22:02:59 -07:00
Mitchell Hashimoto
1835a03842 terraform: hook parameter is an InstanceInfo 2014-09-25 10:40:44 -07:00
Mitchell Hashimoto
1b5d0ed0bb terraform: outputs should be properly calculated for modules now 2014-09-23 15:46:20 -07:00
Mitchell Hashimoto
c164839ed1 terraform: walkContext 2014-09-23 13:21:45 -07:00
Mitchell Hashimoto
7a97396583 terraform: remove unused function 2014-09-21 22:35:11 -07:00
Mitchell Hashimoto
73e2a43427 terraform: don't put the ResourceState in Resource 2014-09-21 22:08:21 -07:00
Armon Dadgar
4b0f970659 terraform: fixing test errors 2014-09-16 15:09:40 -07:00
Mitchell Hashimoto
281b59533d fmt 2014-09-09 21:44:40 -07:00
Mitchell Hashimoto
9573d1bfec terraform: test to make sure nil in RawConfig is okay 2014-09-09 17:41:05 -07:00
Mitchell Hashimoto
9ecfdc350e terraform: ResourceConfig.Get doesn't panic if exceed list bounds
[GH-210]
2014-08-21 11:37:14 -07:00
Mitchell Hashimoto
d8a999e5af terraform: ResourceConfig.Get gets interpolated if possible 2014-08-19 09:05:19 -07:00
Mitchell Hashimoto
361dbb14ae terraform: test for Resource.Vars 2014-06-30 20:59:23 -07:00