Commit Graph

7955 Commits

Author SHA1 Message Date
Martin Atkins
f897863288 providers/terraform: test that validation does not configure backend 2020-05-07 11:08:10 -07:00
Ben Drucker
db1a623ed4 backend/terraform: additional test coverage for error cases in getBackend 2020-05-07 11:08:10 -07:00
Ben Drucker
81b8891b90 providers/terraform: don't call backend.Configure to validate terraform_remote_state
Validation is supposed to be a local-only operation, but Configure implementations
are allowed to make outgoing requests to remote APIs to validate settings.
2020-05-07 11:08:10 -07:00
Pam Selle
41d2c4f172
Merge pull request #24321 from davidMcneil/master
Fix permissions of habitat provision's user.toml
2020-03-27 11:29:38 -04:00
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
David McNeil
3a079b04db Change file permission ordering to avoid race condition
Signed-off-by: David McNeil <mcneil.david2@gmail.com>
2020-03-09 11:04:07 -04:00
David McNeil
b95daa87c8 Fix permissions of habitat provision's user.toml
Signed-off-by: David McNeil <mcneil.david2@gmail.com>
2020-03-09 10:24: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