Commit Graph

7949 Commits

Author SHA1 Message Date
Kristin Laemmert c8d64846ad
Mildwonkey/ps import (#24412)
* import: remove Config from ImportOpts

`Config` in ImportOpts was any provider configuration provided by the
user on the command line. This option has already been removed in favor
of only taking the provider from the configuration loaded in the current
context.

* terrafrom: add Config to ImportStateTransformer and refactor Transform
to get the resource provider FQN from the Config
2020-03-20 08:15:29 -04:00
Paddy e6592dc710
Add support for provider metadata to modules. (#22583)
Implement a new provider_meta block in the terraform block of modules, allowing provider-keyed metadata to be communicated from HCL to provider binaries.

Bundled in this change for minimal protocol version bumping is the addition of markdown support for attribute descriptions and the ability to indicate when an attribute is deprecated, so this information can be shown in the schema dump.

Co-authored-by: Paul Tyng <paul@paultyng.net>
2020-03-05 16:53:24 -08:00
Kristin Laemmert 9891d0354a
providers: use addrs.Provider as map keys for provider.Factory (#23548)
* terraform/context: use new addrs.Provider as map key in provider factories
* added NewLegacyProviderType and LegacyString funcs to make it explicit that these are temporary placeholders

This PR introduces a new concept, provider fully-qualified name (FQN), encapsulated by the `addrs.Provider` struct.
2019-12-04 11:30:20 -05:00
Alex Harvey cbeedfca35 provisioner/puppet: fix bug when connection type was not set in config (#23057)
Before this, the Terraform Puppet provisioner would error out in a
confusing way if the type attribute in a connection block was not given.

Apparently an omitted type leads to type having a value "" which must be
then assumed to mean "ssh".

Fixes #23004
2019-10-17 11:46:55 -04:00
Pam Selle b40385772e
Merge pull request #22705 from kmott/habitat-provisioner-updates
Habitat provisioner updates
2019-10-01 14:27:52 -04:00
Kyle Mott 30895a6cf5 Merge cleanup, remove `license` parameter in favor of bool `accept_license`, adjust how license acceptance is done, update hab provisioner doc. 2019-09-29 11:16:25 -07:00
Kyle Mott e3d1876f44 Merge upstream 2019-09-27 16:38:50 -07:00
James Bardin a3c374b227 don't lose track of private data in the ACC tests
If the resource schema version is > 0, the metadata containing the
timeout values was overwritten during acceptance tests.
2019-09-18 13:59:12 -04:00
Pam Selle 80dec63917
Merge pull request #22691 from pselle/customizediff
Evaluate ignore changes before sending plan to CustomizeDiff
2019-09-11 14:45:21 -04:00
Mudassar Shafique 50a6c69ab5 Habitat License Acceptance changes. These changes add a new argument that allows users to accept Habitat End User License.
It also containts doc updates for Habitat and Chef provisioner
2019-09-09 23:03:39 +05:00
Pam Selle 2e5a8c0f6e Update when ignore_changes are evaluated, to impact customizediff 2019-09-09 09:35:10 -04:00
Kyle Mott 997761ef41 Remove commented out code. 2019-09-05 09:45:33 -07:00
Kyle Mott 164332bfa1 Update Linux Habitat Provisioner to support new licensing, options cleanup. 2019-09-05 09:44:35 -07:00
James Bardin a94f5ee132 prevent panics when encountering nil diffs
While we can't change the behavior of helper/schema at this point, we
can protect against panics in the case of unexpected nils in the
instance diff.
2019-09-04 16:51:42 -04:00
Alex Pilon c993fc3c1b
better error handling for type assertions 2019-08-06 20:49:55 -04:00
Alex Pilon 4bf43efcfd
move hcl2shim package to configs 2019-08-06 19:58:58 -04:00
Alex Pilon d1448fc319
restore test
switch provisioner validation to cast to []interface{} first
2019-08-05 22:08:04 -04:00
Alex Pilon 83aa07f907
prune NewResourceConfig and update tests 2019-08-05 22:08:03 -04:00
Pam Selle 291cf8c5a4
Revert "Habitat License Acceptance changes. " 2019-08-05 12:43:55 -04:00
Pam Selle 9020636f93
Merge pull request #21345 from mudash/master
Habitat License Acceptance changes.
2019-08-05 12:40:34 -04:00
James Bardin 682286e184 test for Required win MinItems > 1 2019-07-26 14:36:19 -07:00
Alex Pilon 7f8f198719
remove UnknownVariabeValue from config and update references to shim 2019-07-17 22:41:24 -04:00
James Bardin efd2a6cef6 dynamic set block test 2019-07-12 16:48:49 -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
Radek Simko 5b9f2fafc8 Standardise directory name for test data 2019-06-30 10:16:15 +02:00
James Bardin 0d2363a058 add tests to preserve existing Set nil behavior
While it may not be intuitive, providers expect that setting a `nil`
value will appear as an empty string in state.
2019-06-28 12:09:50 -04:00
James Bardin 75602df5ef Revert "Remove removed attribute from applied state"
This reverts commit 2e2a363052.
2019-06-28 11:51:52 -04:00
James Bardin 0d9f84414a
Merge pull request #21879 from hashicorp/jbardin/sdk-panics
prevent sdk panics in 2 specific cases
2019-06-25 15:38:15 -04:00
James Bardin fe11724678 test for panic when readin empty map 2019-06-25 14:24:31 -04:00
James Bardin f362198467
Merge pull request #21806 from hashicorp/jbardin/lost-empty-strings
prevent an empty string from being lost
2019-06-25 12:32:06 -04:00
James Bardin c4874aa5b3 add more timeout provider tests 2019-06-19 22:48:15 -04:00
James Bardin 4dcda04d96 prevent an empty string from being lost
The helper/schema diff process loses empty strings, causing them to show
up as unset (null) during apply. Besides failing to show as set by
GetOk, the absence of the value also triggers the schema to insert a
default value again during apply.

It would also be be preferable if the defaults weren't re-evaluated
again during ApplyResourceChange, but that would require a more invasive
patch to the field readers, and ensuring the empty string is stored in
the plan should block the default.
2019-06-19 17:42:00 -04:00
James Bardin 8ae31aa2db normalize empty blocks during import
Like Upgrade, Import is another case where we don't have the context of
the configuration and need to ensure missing blocks are normalized.
2019-06-17 20:29:01 -04:00
James Bardin 2e2a363052 Remove removed attribute from applied state
When a Diff contains a NewRemoved attribute (which would have been null
in the planned state), the final value is often the "zero" value string
for the type, which the provider itself still applies to the state.
Rather than risking a change of behavior in helper/schema by fixing the
inconsistency, we'll remove the NewRemoved attributes after apply to
prevent further issues resulting from the change in planned value.
2019-06-13 17:29:25 -04:00
Tim Sharpe 615110e13e provisioner: new Puppet provisioner (#18851)
* Basic Puppet provisioner

* (fixup) fix snake_case use in Bolt

* (fixup) Remove unused ValidateFunc

* (fixup) Check bolt result status

* (lint) go fmt

* Requested changes

* Remove PE autodetection

* Apply suggestions from @svanharmelen

Co-Authored-By: rodjek <tim@sharpe.id.au>

* Tag all JSON fields in bolt output

* Defer comm.Disconnect() as suggested

* Make bolt timeout configurable

* Update builtin/provisioners/puppet/resource_provisioner.go

Co-Authored-By: rodjek <tim@sharpe.id.au>

* Make extension_requests and custom_attributes configurable
2019-06-10 15:31:21 -04: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
James Bardin a056b84cdd add delete timeout test
The timeout value is still not being persisted.

While it doesn't fix this issue, make sure to always return Private
during Plan.
2019-06-05 19:22:46 -04:00
Mudassar Shafique 258319e6b0 Adding a comment to explain a testcase 2019-06-05 13:52:53 -07:00
James Bardin c658fe173a test a dynamic block with MinItems in the schema
A dynamic block is always going to be a single value during validation,
but should not fail when min-items > 1 is specified.
2019-05-31 20:07:41 -05:00
James Bardin 6055cb632e filter unknowns from simple lists and maps in sdk
While there was already a check in the sdk to filter unknowns from
validation, it missed the case where those were in simple lists and maps.
2019-05-28 09:58:07 -04:00
Mudassar Shafique e78658de4c Habitat License Acceptance changes. These changes add a new argument that allows users to accept Habitat End User License. 2019-05-16 16:55:07 -07:00
James Bardin c391f3a1a3 failing test for cty conversion bug 2019-05-16 16:40:17 -04:00
James Bardin b9e5745b3c remove SkipCoreTypeCheck and LegacySchema
Update the test provider to match the sdk.
2019-05-14 18:19:18 -04:00
James Bardin 6bc36d3321 validate integers when using protoV5
The new type system only has a Number type, but helper schema
differentiates between Int and Float values. Verify that a new config
value is an integer during Validate, because the existing WeakDecode
validation will decode a float value into an integer while the config
FieldReader will attempt to parse the float exactly.

Since we're limiting this to protoV5, we can be certain that any valid
config value will be converted to an `int` type by the shims. The only
case where an integral float value will appear is if the integer is out
of range for the systems `int` type, but we also need to prevent that
anyway since it would fail to read in the same manner.
2019-05-11 09:34:28 -04:00
James Bardin 7075bc9a4d restrict the ComputedKeys usage to containers
Computed primitive values must see the UnknownConfigValue or they are
assumed to be unchanged. Restrict the usage of the protov5 ComputedKeys
to containers.
2019-05-06 19:19:10 -04:00
Martin Atkins 083af21d30 providers/terraform: Explicit validate step
We were previously catching some errors at read time, but some type errors
were panicking because the cty.DynamicPseudoType arguments have no
automatic pre-type-checking done but this code was assuming they would
be objects.

Here we add an explicit validation step that includes both the backend
validation we were previously doing during read and some additional
type checking to ensure the two dynamic arguments are suitably-typed.
Having the separate validation step means that these problems can be
detected by "terraform validate", rather than only in "terraform plan"
or "terraform apply".
2019-05-04 21:06:31 -07:00
James Bardin f9dfa98533 test to make sure a data source is planned
The data source here needs to be re-read during apply, because its
config is changing.
2019-05-03 16:25:37 -04:00
Martin Atkins 332010fd56 plans/objchange: Fix handling of dynamic block placeholders
If a dynamic block (in the HCL dynamic block extension sense) has an
unknown value for its for_each argument, it gets expanded to a single
placeholder block with all of its attributes set to a unknown values.

We can use this as part of a heuristic to relax our object compatibility
checks for situations where the plan included an object that appears to
be (but isn't necessarily) such a placeholder, allowing for the fact that
the one placeholder block could be replaced with zero or more real blocks
once the for_each value is known.

Previously our heuristic was too strict: it would match only if the only
block present was a dynamic placeholder. In practice, users may mix
dynamic blocks with static blocks of the same type, so we need to be more
liberal to avoid generating incorrect incompatibility errors in such
cases.
2019-05-02 14:08:40 -07:00
James Bardin 0f883b118a test that computed maps are applied correctly
Verify that a computed map which is not correctly marked as unknown in
the plan is still applied correctly.
2019-04-23 12:31:19 -04:00
James Bardin 67395306e1 delete unknown values from apply config altogether
removeConfigUnknowns need to remove the value completely from the config
map. Removing this value allows GetOk and GetOkExists to indicate if the
value was set in the config in the case of an Optional+Computed
attribute.
2019-04-22 18:06:26 -04:00