Commit Graph

2604 Commits

Author SHA1 Message Date
Pam Selle 901ec990ed
Merge pull request #22156 from binlab/feature/bastion-ca-ssh
Add SSH certificate authentication method for connection via Bastion
2019-08-15 16:01:54 -04:00
Pam Selle e2931763bf
Merge pull request #22454 from pselle/nokeymoregraph
Add edge when calculating for_each orphans
2019-08-13 17:35:20 -04:00
Pam Selle e6817f6319 Reordering, comment update 2019-08-13 17:22:14 -04:00
Pam Selle 06e72c693f Add test 2019-08-13 16:31:07 -04:00
Pam Selle 6fae69f07b Creating the node would be nice 2019-08-13 10:38:52 -04:00
Pam Selle b9fa724273 Add edge 2019-08-13 10:24:26 -04:00
Pam Selle 3662dbc03d Ensure no key added to graph first 2019-08-13 10:10:36 -04:00
Radek Simko 98a796c3a3
Merge pull request #22272 from hashicorp/f-httpclient-ua
httpclient: Introduce composable UserAgent()
2019-08-12 20:20:03 +01:00
Alex Pilon 07d6289701
add comment noting deprecated type 2019-08-08 11:14:26 -04:00
Alex Pilon 77757d9f5b
prune references to config/module
delete config/module
prune references to config except in terraform/resource.go
move, cleanup, and delete inert code
2019-08-07 17:50:59 -04:00
Alex Pilon 4bf43efcfd
move hcl2shim package to configs 2019-08-06 19:58:58 -04:00
Alex Pilon 2a01704208
restore legacy functions for back compat 2019-08-06 15:22:28 -04:00
Alex Pilon 732211617e
fix typo 2019-08-05 22:08:04 -04:00
Alex Pilon 83aa07f907
prune NewResourceConfig and update tests 2019-08-05 22:08:03 -04:00
Radek Simko 34d90d4be0
httpclient: Introduce composable UserAgent()
This interface is meant to replace the following ones (in use by some providers):

 - httpclient.UserAgentString() (e.g. AzureRM, Google)
 - terraform.UserAgentString (e.g. OpenStack, ProfitBricks)
 - terraform.VersionString (e.g. AWS, AzureStack, DigitalOcean, Kubernetes)

This also proposes the initial UA string to be set to

    HashiCorp Terraform/X.Y.Z (+https://www.terraform.io)
2019-08-05 11:07:21 +01:00
Pam Selle c6692c108b
Merge pull request #22291 from hashicorp/pselle/fix-foreach-provisioners
Ensure each references evaluated in provisioners block
2019-08-01 14:24:38 -04:00
Pam Selle 2015dd293f Fix #22289 2019-08-01 11:04:48 -04:00
tmatias c20c40c9aa
diagnose tuple values being passed as argument to for_each 2019-08-01 11:33:46 -03:00
tmatias e825dd0428
make validation on for_each argument more precise 2019-07-31 19:29:50 -03:00
Thayne McCombs b9af3cd86b Support using self in the provisioner of resources that use for_each 2019-07-29 01:18:33 -06:00
Pam Selle e7d8ac5ad7 Remove panic, update comment 2019-07-26 11:22:10 -04:00
Thayne McCombs 7c678d104f Add support for for_each for data blocks.
This also fixes a few things with resource for_each:

It makes validation more like validation for count.

It makes sure the index is stored in the state properly.
2019-07-25 16:59:06 -04:00
Pam Selle 7d905f6777 Resource for_each 2019-07-22 10:51:16 -04:00
Mark 3031aca971 Add SSH cert authentication method for connection via Bastion 2019-07-21 09:32:48 +03:00
Alex Pilon c2bc88fc23
prune ResourceProviderFullName and its callers 2019-07-18 15:24:34 -04:00
Alex Pilon e3bc1e7d5c
move VarEnvPrefix out of terraform pkg 2019-07-18 14:19:39 -04:00
Alex Pilon 7f8f198719
remove UnknownVariabeValue from config and update references to shim 2019-07-17 22:41:24 -04:00
James Bardin 5ac920223f
Merge pull request #22001 from hashicorp/jbardin/update-cty
Update cty and use Path.Equals in depends_on comparisons
2019-07-11 08:49:10 -04:00
James Bardin a0338df4d4 update ignore_changes to use cty.Path.Equals
Remove reflect.DeepEqual from path comparisons to get reliable results.

The equality issues were only noticed going the grpc interface, so add a
corresponding test to the test provider.
2019-07-10 14:49:37 -04:00
Bodo Petermann a22891deba Fixes crash #21896
Fix for a crash during terraform plan: If there is a multi-instance
resource (count > 1) where one of the instances was deleted in the
deployment but was still present in the terraform state,
getResourceInstancesAll crashed.

Check not only for rs.Instances[key] to exist, but also to have a
valid Current pointer.
2019-07-04 17:11:19 +02:00
Radek Simko 5b9f2fafc8 Standardise directory name for test data 2019-06-30 10:16:15 +02:00
Martin Atkins 1bba574fe9 website: Document ignore_changes for individual map elements
This also includes a previously-missing test that verifies the behavior
described here, implemented as a planning context test for consistency
with how the other ignore_changes tests are handled.
2019-06-18 17:37:24 -07:00
James Bardin d33c5163a7
Merge pull request #21555 from hashicorp/jbardin/re-validate
Allow providers to re-validate the final resource config
2019-06-07 16:43:38 -04:00
tinocode 51a4055198 core: Fix panic on invalid depends_on root. (#21589)
Report an invalid reference to the user instead of crashing when there is in error traversing the `depends_on` attribute.

Fixes #21590
2019-06-06 08:43:22 -04:00
James Bardin 49fee6ba78 don't lose private data during destroy
Makre sure private data is maintained all the way to destroy. This
slipped through, since private data isn't used much for current
providers, except for timeouts.
2019-06-05 19:22:46 -04:00
James Bardin dcab82e897 send and receive Private through ReadResource
Send Private data blob through ReadResource as well. This will allow for
extra flexibility for future providers that may want to pass data out of
band through to their resource Read functions.
2019-06-03 18:08:26 -04:00
James Bardin 2b200dd9bb re-validate data source config during read
Just like resources, early data soruce validation will contain many
unknown values. Re-validate once we have the config config.
2019-06-01 11:40:54 -04:00
James Bardin c41eb0e6e4 re-validate config during Plan
The config is statically validated early on for structural issues, but
the provider can't validate any inputs that were unknown at the time.
Run ValidateResourceTypeConfig during Plan, so that the provider can
validate the final config values, including those interpolated from
other resources.
2019-06-01 11:09:48 -04:00
Kristin Laemmert 9869fbc5c4
core: don't panic in NodeAbstractResourceInstance References() (#21445)
* core: don't panic in NodeAbstractResourceInstance References()

It is possible for s.Current to be nil. This was hard to reproduce, so
the root cause is still unknown, but we can guard against the symptom.

* add log statement
2019-05-28 17:27:38 -04:00
Martin Atkins bec4641867 core: Don't panic if NodeApplyableResourceInstance has no config
This is a "should never happen" case, because we shouldn't ever have
resources in the plan that aren't in the configuration, but since we've
got a report of a crash here (which went away before we got a chance to
debug it) here's just an extra guard to ensure that we'll still exit
gracefully in that case.

If we see this error crop up again in future, it'd be nice to gather a
full trace log so we can see what GraphNodeAttachResourceConfig did and
why it did not attach a configuration.
2019-05-14 16:54:12 -07:00
James Bardin 059dcf1e25 implement UpgradeResourceState in the mock provider
The default is a Noop that simply encodes the provided state
2019-05-14 18:00:01 -04:00
Martin Atkins bcf2aa06dd core: Call providers' UpgradeResourceState every time
Previously we tried to short-circuit this if the schema version hadn't
changed and we were already using JSON serialization. However, if we
instead call into UpgradeResourceState every time we can let the provider
or the SDK do some general, systematic normalization and cleanup steps
without always requiring a schema version increase.

What exactly would be fixed up this way is for the SDK to decide, but for
example the SDK might choose to automatically delete from the state
anything that is no longer present in the schema, avoiding the need to
write explicit state migration functions for that common case where the
remedy is always the same.

The actual update logic is delegated to the provider/SDK intentionally so
that it can evolve over time and potentially differ depending on how
each SDK thinks about schema.
2019-05-14 13:30:42 -04:00
Radek Simko 8a6d1d62b6
stringer: Regenerate files with latest version 2019-05-13 15:34:27 +01:00
Paul Tyng 15f7f8049f
Fix incorrect direction of TestConformance 2019-05-09 09:16:54 -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 06babb6cc3 remove dead code for the next reader 2019-05-03 17:29:16 -04:00
James Bardin 35e087fe5b always re-read datasource if there are dep changes
If a datasource's dependencies have planned changes, then we need to
plan a read for the data source, because the config may change once the
dependencies have been applied.
2019-05-03 17:29:16 -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
Martin Atkins 3309be9721 core: Allow data resource count to be unknown during refresh
The count for a data resource can potentially depend on a managed resource
that isn't recorded in the state yet, in which case references to it will
always return unknown.

Ideally we'd do the data refreshes during the plan phase as discussed in
#17034, which would avoid this problem by planning the managed resources
in the same walk, but for now we'll just skip refreshing any data
resources with an unknown count during refresh and defer that work to the
apply phase, just as we'd do if there were unknown values in the main
configuration for the data resource.
2019-04-25 14:22:57 -07:00
Martin Atkins cbc8d1eba2 core: Input variables are always unknown during validate
Earlier on in the v0.12 development cycle we made the decision that the
validation walk should consider input values to always be unknown so that
validation is checking validity for all possible inputs rather than for
a specific set of inputs; checking for a specific set of inputs is the
responsibility of the plan walk.

However, we didn't implement that in the best way: we made the
"terraform validate" command force all of the input variables to unknown
but that was insufficient because it didn't also affect the implicit
validation walk we do as part of "terraform plan" and "terraform apply",
causing those to produce confusingly-different results.

Instead, we'll address the problem directly in the reference resolver code,
ensuring that all variable values will always be treated as an unknown
(of the declared type, so type checking is still possible) during any
validate walk, regardless of which command is running it.
2019-04-17 10:09:46 -07:00