Commit Graph

26339 Commits

Author SHA1 Message Date
charlotte.mach 172d6caf04 Add info on dynamodb locking multiple state files as per issue #15303 2020-05-13 15:04:56 -07:00
Daniel Dreier 7aa8e65e16 Remove hashibot panic issue labeler
HashiBot labels issues as "crash" and "bug" when they container "panic:". This causes issues to bypass human triage, which means that provider-specific panics are put in our issue list rather than being labeled correctly. This removes that rule to allow for human labeling.
2020-05-13 11:58:57 -07:00
James Bardin 291110fe78 Don't use plans.Update for data sources
The new data source planning logic no longer needs a separate action,
and the apply status can be determined from whether the After value is
complete or not.
2020-05-13 13:58:11 -04:00
James Bardin 8850d787f4 add evalWriteEmptyState for data source removal 2020-05-13 13:58:11 -04:00
James Bardin 7b8f13862c un-export new data eval nodes 2020-05-13 13:58:11 -04:00
James Bardin 8e3728af54 rename methods for ConfigResource changes 2020-05-13 13:58:11 -04:00
James Bardin c6c851eb3f add test for using a data source with depends_on
Ensure that a data source with depends_on not only plans to update
during refresh, but evaluates correctly in the plan ensuring
dependencies are planned accordingly.
2020-05-13 13:58:11 -04:00
James Bardin 44919641ef set state in deferred data read
The state was not being set, so the change was not evaluated correctly
for dependant resources.

Remove use of cty.NilVal in readDataSource, only one place was using it,
so the code could just be moved out.

Fix a bunch of places where warnings would be lost.
2020-05-13 13:58:11 -04:00
James Bardin 05575a863c check for data source changed during plan
Rather than re-read the data source during every plan cycle, apply the
config to the prior state, and skip reading if there is no change.

Remove the TODOs, as we're going to accept that data-only changes will
still not be plan-able for the time being.

Fix the null data source test resource, as it had no computed fields at
all, even the id.
2020-05-13 13:58:11 -04:00
James Bardin 6ca252faab refactor EvalReadData
The logic for refresh, plan and apply are all subtly different, so
rather than trying to manage that complex flow through a giant 300 line
method, break it up somewhat into 3 different types that can share the
types and a few helpers.
2020-05-13 13:58:11 -04:00
James Bardin 96be76effb cleanup refresh test 2020-05-13 13:58:11 -04:00
James Bardin 4a92b7888f start to refactor EvalReadData
Remove extra fields, remove the depends_on logic from
NodePlannableResourceInstnace, and start breaking up the massive Eval
method.
2020-05-13 13:58:11 -04:00
James Bardin be20a7941d remove EvalReadDataApply
EvalReadDataApply was all dead code, as it was only using during delete
and simply set the state to nil.
2020-05-13 13:58:11 -04:00
James Bardin cf2dd43f30 add data responses where they were missing
A few test with had data sources that were never read before, and needed
to get valid responses for the tests.
2020-05-13 13:58:11 -04:00
James Bardin 047c9b3cc6 missing id in schema in plan test
The data source was never read, so the schema was never verified.
2020-05-13 13:58:11 -04:00
James Bardin 924162923a Fix some plan tests with planned data
Start fixing plan tests that don't expect data sources to be in the
plan. A few were just checking that Read was never called, and some
expected the data source to be nil.
2020-05-13 13:58:11 -04:00
James Bardin 7df0f6c1fc read data sources during plan
In order to udpate data sources correctly when their configuration
changes, they need to be evaluated during plan. Since the plan working
state isn't saved, store any data source reads as plan changes to be
applied later. This is currently abusing the Update plan action to
indicate that the data source was read and needs to be applied to state.
We can possibly add a Store action for data sources if this approach
works out.  The Read action still indicates that the data source was
deferred to the Apply phase.

We also fully handle any data source depends_on changes. Now that all
the transitive resource dependencies are known at the time of
evaluation, we can check the plan to determine if there are any changes
in the dependencies and selectively defer reading the data source.
2020-05-13 13:58:11 -04:00
James Bardin 0f5dab4838 always load data source state during refresh
We need to load the state during refresh, so that even if the data
source can't be read due to `depends_on`, the state can be saved back
again to prevent it from being lost altogether.

This is a step towards having data sources refresh like resources, which
will be from their saved state value.
2020-05-13 13:58:11 -04:00
James Bardin 23e259a68c add AttachDependsOnTransformer to plan
This transformer is what will provider the data sources with the
transitive dependencies needed to determine if they can read during plan
or must be deferred.
2020-05-13 13:58:11 -04:00
Kristin Laemmert d350818126
internal/getproviders: fix panic with invalid path parts (#24940)
* internal/getproviders: fix panic with invalid path parts

If the search path is missing a directory, the provider installer would
try to create an addrs.Provider with the wrong parts. For example if the
hostname was missing (as in the test case), it would call
addrs.NewProvider with (namespace, typename, version). This adds a
validation step for each part before calling addrs.NewProvider to avoid
the panic.
2020-05-13 13:16:09 -04:00
Petros Kolyvas 95ad52de11
Merge pull request #24942 from izeau/patch-1
website/docs: provider aliases in the JSON format
2020-05-13 11:59:09 -04:00
Alisdair McDiarmid c3c8fbd4db
Merge pull request #24917 from hashicorp/alisdair/registry-retries
internal/getproviders: Add configurable HTTP retry & timeout support
2020-05-13 10:17:12 -04:00
Jean Dupouy a54bb124a9
website/docs: provider aliases in the JSON format
Fixes #24889
2020-05-13 15:52:26 +02:00
Alisdair McDiarmid 070c3018f8 internal/providercache: Remove unused retry events 2020-05-13 09:48:41 -04:00
Alisdair McDiarmid e27a36cafd internal/getproviders: Retry failed HTTP requests
This is a port of the retry/timeout logic added in #24260 and #24259,
using the same environment variables to configure the retry and timeout
settings.
2020-05-13 09:48:41 -04:00
Alisdair McDiarmid 9a5e5bb5fc
Merge pull request #24841 from rafalpotempa/upgrade-crypto
Security: Upgrade version of golang.org/x/crypto to latest
2020-05-13 09:19:36 -04:00
Kazuki Higashiguchi 7e46b6b9e7 fix typo ResourceInstancChange to ResourceInstanceChange 2020-05-13 17:14:58 +09:00
Rafal Potempa 2646e42ac9 Upgrade version 2020-05-13 09:33:27 +02:00
Rafal Potempa b630543985 Upgrade crypto 2020-05-13 09:31:39 +02:00
James Bardin 6cf3f76623 update CHANGELOG.md 2020-05-12 17:12:41 -04:00
James Bardin e912dc8551
Merge pull request #19155 from bdwyertech/chef-exit-codes
Chef: Gracefully Handle RFC062 Exit Codes
2020-05-12 17:09:05 -04:00
James Bardin 2b9cb0e0e1
Merge pull request #24930 from hashicorp/jbardin/rename-expanders
Rename expanders
2020-05-12 16:16:12 -04:00
James Bardin 07c35dd4df update test strings
Match the new names output by the expander nodes
2020-05-12 11:07:00 -04:00
James Bardin 5cb6c86b32 rename plannable output
NodePlannableOutput is now the expander node, and is used in contexts
other than planning. Change the name to nodeExpandOutput
2020-05-12 11:07:00 -04:00
James Bardin 3a3eaa1ddf rename plannable local
NodePLannableLocal is now the expander node, and is is also used in
contexts other than plan. Change the name to nodeExpandLocal.
2020-05-12 11:07:00 -04:00
James Bardin a2d2ce35dc remove "prepare state" from expanders
That name tag was left in only to reduce the diff when during
implementation. Fix the naming now for these nodes so it is correct, and
prevent any possible name collision between types.
2020-05-12 10:28:33 -04:00
Kristin Laemmert 862dc36884
command/init: include config loader diagnostics in output (#24921)
Previously the diagnostics from the config loaders (earlyconfig and
regular) were only appended to the overall diags if an error was found.
This adds all diagnostics from the regular config loader so that any
generated warnings will be displayed, even if there are no errors.

I did not add the `earlyconfig` warnings since they will be displayed if
there is an error and are likely to be duplicated by the config loader.
2020-05-12 08:39:12 -04:00
Alisdair McDiarmid 14985469b4
Merge pull request #24915 from hashicorp/alisdair/013upgrade-docs
website: Add docs for 0.13upgrade
2020-05-11 15:42:25 -04:00
Alisdair McDiarmid 20483da548 website: Add docs for 0.13upgrade 2020-05-11 15:38:16 -04:00
Kristin Laemmert 60321b41e8
getproviders: move protocol compatibility functions into registry client (#24846)
* internal/registry source: return error if requested provider version protocols are not supported

* getproviders: move responsibility for protocol compatibility checks into the registry client

The original implementation had the providercache checking the provider
metadata for protocol compatibility, but this is only relevant for the
registry source so it made more sense to move the logic into
getproviders.

This also addresses an issue where we were pulling the metadata for
every provider version until we found one that was supported. I've
extended the registry client to unmarshal the protocols in
`ProviderVersions` so we can filter through that list, instead of
pulling each version's metadata.
2020-05-11 13:49:12 -04:00
Alisdair McDiarmid 1d834fb1d0
Merge pull request #24906 from hashicorp/alisdair/013upgrade-confirm
command: Add prompt & confirmation to 0.13upgrade
2020-05-11 12:29:46 -04:00
Alisdair McDiarmid 82ebbf9a23 command: Add prompt & confirmation to 0.13upgrade 2020-05-11 09:32:11 -04:00
Alisdair McDiarmid 47cd97bee2
Merge pull request #24903 from hashicorp/alisdair/lookup-legacy-provider-fix
internal: Fix LookupLegacyProvider
2020-05-11 09:13:16 -04:00
Alisdair McDiarmid 62b0cbed12 internal: Fix LookupLegacyProvider
When looking up the namespace for a legacy provider source, we need to
use the /v1/providers/-/{name}/versions endpoint. For non-HashiCorp
providers, the /v1/providers/-/{name} endpoint returns a 404.

This commit updates the LegacyProviderDefaultNamespace method and the
mock registry servers accordingly.
2020-05-08 12:29:25 -04:00
James Bardin 18ca98a064 GetConfigResourceChanges from plans
In order to find any changes related to a particular configuration
address, we need a new method to get changes to all possible instances.
2020-05-08 12:25:56 -04:00
James Bardin f8907b9213 add AttachDependsOnTransformer
Adding a transformer to attach any transitive DependsOn references to
data sources during plan. Refactored the ReferenceMap from the
ReferenceTransformer so it can be reused for both.
2020-05-08 12:25:56 -04:00
James Bardin 3e5b8d4aaa add GraphNodeAttachDependsOn
GraphNodeAttachDependsOn give us a method for adding all transitive resource
dependencies found through depends_on references, so that data source
can determine if they can be read during plan. This will be done by
inspecting the changes of all dependency resources, and delaying read
until apply if any changes are planned.
2020-05-08 12:25:56 -04:00
Pam Selle f82700bc56
Disallow provider configuration in expanding modules (#24892)
Validate providers in expanding modules. Expanding modules cannot have provider configurations with non-empty configs, which includes having a version configured. If an empty or alias-only block is passed, the provider must be passed through the providers argument on the module call
2020-05-08 11:35:28 -04:00
Chris Griggs 53a36a11b2
Merge pull request #24875 from hashicorp/cgriggs01-community
[Website] Adding community providers
2020-05-08 07:59:46 -07:00
Alisdair McDiarmid 0104e63c64
Merge pull request #24894 from hashicorp/alisdair/013upgrade-required-version
command: 0.13upgrade command checks and updates required_version
2020-05-08 08:50:56 -04:00