Commit Graph

25367 Commits

Author SHA1 Message Date
James Bardin 32ae3b5452 make dag.Set a simple map
This allows iteration directly over the set, removing the need to
allocate and copy a new slice for every iteration.
2020-02-19 14:46:35 -05:00
Pam Selle 991ee37cee
Update CHANGELOG.md 2020-02-19 13:28:06 -05:00
tf-release-bot 39ce190852 Cleanup after v0.12.21 release 2020-02-19 18:18:47 +00:00
Chris Griggs 5f27856766
Merge pull request #24156 from hashicorp/cgriggs01-baiducloud-docs
[Website] add new provider links
2020-02-18 17:09:29 -08:00
im2nguyen 4f10504ca0
website: add token setup callout to remote backend docs (#24109) 2020-02-18 16:28:12 -08:00
Nick Fagerlund d41981eabb website: Private registry is free now 2020-02-18 16:10:35 -08:00
Martin Atkins 86f0b5191c addrs: Stronger validation and normalization of provider namespace/type
The provider FQN is becoming our primary identifier for a provider, so
it's important that we are clear about the equality rules for these
addresses and what characters are valid within them.

We previously had a basic regex permitting ASCII letters and digits for
validation and no normalization at all. We need to do at least case
folding and UTF-8 normalization because these names will appear in file
and directory names in case-insensitive filesystems and in repository
names such as on GitHub.

Since we're already using DNS-style normalization and validation rules
for the hostname part, rather than defining an entirely new set of rules
here we'll just treat the provider namespace and type as if they were
single labels in a DNS name. Aside from some internal consistency, that
also works out nicely because systems like GitHub use organization and
repository names as part of hostnames (e.g. with GitHub Pages) and so
tend to apply comparable constraints themselves.

This introduces the possibility of names containing letters from alphabets
other than the latin alphabet, and for latin letters with diacritics.
That's consistent with our introduction of similar support for identifiers
in the language in Terraform 0.12, and is intended to be more friendly to
Terraform users throughout the world that might prefer to name their
products using a different alphabet. This is also a further justification
for using the DNS normalization rules: modern companies tend to choose
product names that make good domain names, and now such names will be
usable as Terraform provider names too.
2020-02-18 15:42:09 -08:00
Chris Griggs 68d5af7df2 add Baidu links + okta 2020-02-18 15:10:16 -08:00
Alisdair McDiarmid 205408f6a5
Merge pull request #24124 from hashicorp/alisdair/fix-for-each-on-set-containing-null
terraform: detect null values in for_each sets
2020-02-18 12:57:50 -05:00
Alisdair McDiarmid 1b1a62026c terraform: Add test coverage for eval_for_each 2020-02-18 07:07:24 -05:00
Kristin Laemmert 2a646aba46 comment cleanup: those FIXME comments are load-bearing and must be up to date 2020-02-14 15:41:31 -08:00
Kristin Laemmert ac56d12c5c terraform: replace addrs.NewLegacyProvider with lookups when the
configs.Module is accessible.

Continuing the work of removing all calls to addrs.NewLegacyProvider,
this commit uses configs.Module.ProviderForLocalConfig wherever the
caller has access to that Module.
2020-02-14 15:41:31 -08:00
Kristin Laemmert 228d881722 terraform: remove no-longer-necessary type strings
EvalContext.InitProvider no longer needs the redundant typ String
terraform.contextComponentFactory refactored to take an addrs.Provider
instead of a string.
2020-02-14 15:41:31 -08:00
Kristin Laemmert 6e2618d9be terraform: ProviderTransform gets provider fqn from module
Added configs.Module.ProviderForLocalProviderConfig which allows
terraform.ProviderTransformer to get the provider FQN from the module,
instead of assuming NewLegacyProvider.
2020-02-14 15:41:31 -08:00
Martin Atkins c02a898994 core: InstanceKeyEvalData now aliases instances.RepetitionData
We're not far enough along yet to be able to actually use the
RepetitionData instances provided by the instances package, but having
these types be considered identical will help us to gradually migrate over
as we prepare the rest of Terraform to properly populate the Expander.
2020-02-14 15:20:07 -08:00
Martin Atkins 68b900928d core: Use instances.Expander to handle resource count and for_each
This is a minimal integration of instances.Expander used just for resource
count and for_each, for now just forcing modules to always be singletons
because the rest of Terraform Core isn't ready to deal with expanding
module calls yet.

This doesn't integrate super cleanly yet because we still have some
cleanup work to do in the design of the plan walk, to make it explicit
that the nodes in the plan graph represent static configuration objects
rather than expanded instances, including for modules. To make this work
in the meantime, there is some shimming between addrs.Module and
addrs.ModuleInstance to correct for the discontinuities that result from
the fact that Terraform currently assumes that modules are always
singletons.
2020-02-14 15:20:07 -08:00
Martin Atkins 8ea78dfe7d core: Make an instances.Expander available to every graph walk
This is not used yet, but in future commits will be used as a
"blackboard" to centrally aggregate the information pertaining to
expansion of resources and modules (using "count" or "for_each") to help
ensure consistent treatment of the expansion process during a graph walk.

In practice this only really makes sense for the plan walk, because the
apply walk doesn't do any dynamic expansion.
2020-02-14 15:20:07 -08:00
Martin Atkins 1dece66b10 instances: A package for module/resource reptition
This package aims to encapsulate the module/resource repetition problem
so that Terraform Core's graph node DynamicExpand implementations can be
simpler.

This is also a building block on the path towards module repetition, by
modelling the recursive expansion of modules and their contents. This will
allow the Terraform Core plan graph to have one node per configuration
construct, each of which will DynamicExpand into as many sub-nodes as
necessary to cover all of the recursive module instantiations.

For the moment this is just dead code, because Terraform Core isn't yet
updated to use it.
2020-02-14 15:20:07 -08:00
Martin Atkins 657f9502e4 addrs: ModuleInstance.Module
This returns the address of the module that the module instance is an
instance of.
2020-02-14 15:20:07 -08:00
Martin Atkins 9f727b5799 addrs: ModuleInstanceStep.String
When ModuleInstanceStep values appear alone in debug messages, it's easier
to read them in a compact, HCL-like form than as the default struct
printing style.
2020-02-14 15:20:07 -08:00
Alisdair McDiarmid 0ef7d6dea7 terraform: detect null values in for_each sets
Previously, passing `[null, null]` to `for_each` caused a panic. This
commit detects this invalid usage and returns an error instead.

Fixes #24047
2020-02-14 17:20:08 -05:00
Alisdair McDiarmid 678760b61a
Merge pull request #24122 from hashicorp/alisdair/unlock-commentary
command: Comment to explain why unlock is required
2020-02-14 17:04:47 -05:00
Alisdair McDiarmid 7696c14661
Merge pull request #24107 from hashicorp/alisdair/terraform-login-wsl-browser-launcher-fix
command/login: Fix browser launcher for WSL users
2020-02-14 16:32:35 -05:00
Alisdair McDiarmid aa38cbe3bc command: Comment to explain why unlock is required 2020-02-14 16:29:07 -05:00
Alisdair McDiarmid 7d8ac1e318
Merge pull request #24120 from hashicorp/alisdair/fix-stale-lock-when-exiting-early
command: Fix stale lock when exiting early
2020-02-14 15:53:03 -05:00
Alisdair McDiarmid f0cf57e5d3 Remove unused import-provider-mismatch fixture 2020-02-14 14:49:26 -05:00
Alisdair McDiarmid 6413313529 command/graph: Remove no-op state unlock
The graph command never locks the state, so this unlock operation was a
no-op and is a bit of a red herring. Remove it.
2020-02-14 14:48:50 -05:00
Alisdair McDiarmid 701d095808 command: Fix stale lock when exiting early
If an error occurs on creating the context for console or import, we
would fail to unlock the state. Fix this by unlocking slightly earlier.
Affects console and import commands.

Fixes #23318
2020-02-14 14:48:30 -05:00
Pam Selle 980af1cd21
Update README.md 2020-02-14 11:08:33 -05:00
Pam Selle 9d075b1610
Point to forums and remove Gitter 2020-02-14 11:01:24 -05:00
Pam Selle 5f669b033c
Revert back to using image until better solution found 2020-02-14 11:00:25 -05:00
Pam Selle 694f15c7f1
Update README logo 2020-02-14 10:46:11 -05:00
Kristin Laemmert add134298a
addrs: ProviderConfig fixups (#24115)
* fix outdated syntax in comments
* test for non-strings in ParseAbsProviderConfig
* ProviderConfigDefault and ProviderConfigAliased now take Providers
instead of strings
2020-02-14 09:06:50 -05:00
Kristin Laemmert 72ec579807
configs/decodeRequiredProviders test: before comparing slices (#24114) 2020-02-14 08:26:14 -05:00
James Bardin 402c0ed10c update CHANGELOG.md 2020-02-13 21:33:06 -05:00
James Bardin 4185aa93f5 doc typo 2020-02-13 21:27:35 -05:00
James Bardin ded207f3b8
Merge pull request #24083 from hashicorp/jbardin/state-only-destroys
Instance state only destroys
2020-02-13 21:03:10 -05:00
James Bardin 37e60cd883 fix comment text 2020-02-13 20:46:48 -05:00
Chris Griggs be72d59e6d
Merge pull request #24104 from hashicorp/cgriggs01-community-providers
[Website] Adding community providers
2020-02-13 14:14:50 -08:00
James Bardin b4f06c22fe fixup provider types in new tests 2020-02-13 16:05:28 -05:00
James Bardin 099806c128 fixup LocalProviderConfig literal 2020-02-13 15:43:52 -05:00
James Bardin d4d99be2db remove some destroy special cases
We no longer need special cases for most things during a full destroy,
so remove those from the graph transformations.

The only remaining cases are:
 - remove the root outputs, so destroy ends up with a clean state
 - reverse the target deps when targeting a destroy.
2020-02-13 15:43:52 -05:00
James Bardin 8c5853ee4e remove old references code from abstract resource 2020-02-13 15:43:52 -05:00
James Bardin ca5b0e6894 no longer need DestroyValueReferenceTransformer
since destroy nodes are no longer connected to values, there's no need
to try and wrangle their edges to prevent cycles during destroy.
2020-02-13 15:43:52 -05:00
James Bardin dc8cdd260c add missing deps to targeted destroy test 2020-02-13 15:43:52 -05:00
James Bardin a4bc91abeb remove invalid destroy provisioner tests
Remove all the destroy provisioner tests that are testing what is no
longer allowed.

Add missing state dependencies to remaining tests that require it.
2020-02-13 15:43:52 -05:00
James Bardin 9edb719aaa run AttachStateTransformer in destroy plan
The AttachStateTransformer was never run in the destroy plan. This means
that resource without configuration that used a non-default provider
would not be connected to the correct provider for the plan.

The test that was attempting to catch this only worked because the
temporary graph used in the DestroyEdgeTransformer would add the state
and detect some issues.
2020-02-13 15:43:19 -05:00
James Bardin a0ba481cad add state where it's now needed for tests 2020-02-13 15:42:10 -05:00
James Bardin 4a41af08b8 new deps are more precise 2020-02-13 15:42:10 -05:00
James Bardin 681d197628 fix DestroyEdgeTransformer tests
The tests require working node implementations with real state.
2020-02-13 15:42:10 -05:00