Commit Graph

28896 Commits

Author SHA1 Message Date
Martin Atkins ae2c93f255 addrs: All AbsMovable implementations implement UniqueKeyer 2021-07-29 12:29:36 -07:00
Kent 'picat' Gruber fc63c1949d
Merge pull request #29215 from hashicorp/configure-dependabot
Add initial Dependabot configuration
2021-07-29 10:26:22 -04:00
Martin Atkins f76a3467dc core: Call into refactoring.ValidateMoves after creating a plan
As of this commit, refactoring.ValidateMoves doesn't actually do anything
yet (always returns nil) but the goal here is to wire in the set of all
declared instances so that refactoring.ValidateMoves will then have all
of the information it needs to encapsulate our validation rules.

The actual implementation of refactoring.ValidateMoves will follow in
subsequent commits.
2021-07-28 13:54:10 -07:00
Martin Atkins 51346f0d87 instances: Expander.AllInstances
In order to precisely implement the validation rules for "moved"
statements we need to be able to test whether particular instances were
declared in the configuration.

The instance expander is the source of record for which instances we
decided while creating a plan, but it's API is far more involved than what
our validation rules need, so this new AllInstances method returns a
wrapper object with a more straightforward API that provides read-only
access to just the question of whether particular instances got registered
in the expander already.

This API covers all three of the kinds of objects that move statements can
refer to. It includes module calls and resources, even though they aren't
_themselves_ "instances" in the sense we usually mean, because the module
instance addresses they are contained within _are_ instances and so we
need to take their dynamic instance keys into account when answering these
queries.
2021-07-28 13:54:10 -07:00
Martin Atkins 57d36c1d9d addrs: ModuleInstance.ChildCall method
This allows us to concisely construct AbsModuleCall address values by
method chaining from module instance addresses.
2021-07-28 13:54:10 -07:00
Martin Atkins 5a6d11e375 addrs: Factor out MoveEndpointInModule module prefix matching
All of our MoveDestination methods have the common problem of deciding
whether the receiver is even potentially in the scope of a particular
MoveEndpointInModule, which requires that the receiver belong to an
instance of the module where the move statement was found.

Previously we had this logic inline in all three cases, but now we'll
factor it out into a shared helper function.

At first it seemed like there ought to be more factoring possible for
the AbsResource vs. AbsResourceInstance implementations, since textually
they look very similar, but in practice they only look similar because
those two types have a lot of method names in common, but the Go compiler
sees them as completely distinct and thus we must write the same logic
out twice. I did try some further refactoring to address that but it
made the resulting code significantly more complicated and, by my
judgement, harder to follow. Consequently I decided that a little
duplication was okay and warranted here because this logic is already
quite fiddly to read through and isn't likely to change significantly once
released (due to backward-compatibility promises).
2021-07-28 13:33:26 -07:00
Martin Atkins 45d16b4a2b addrs: MoveDestination for AbsResourceInstance-based move endpoints
Previously our MoveDestination methods only honored move statements whose
endpoints were module calls, module instances, or resources.

Now we'll additionally handle when the endpoints are individual resource
instances. This situation only applies to
AbsResourceInstance.MoveDestination because no other objects can be
contained inside of a resource instance.

This completes all of the MoveDestination cases for all supported move
statement types and moveable object types.
2021-07-28 13:33:26 -07:00
Martin Atkins 5e86bab159 addrs: MoveDestination for AbsResource-based move endpoints
Previously our MoveDestination methods only honored move statements whose
endpoints were module calls or module instances.

Now we'll additionally handle when the endpoints are whole resource
addresses. This includes both renaming resource blocks and moving resource
blocks into or out of child modules.

This doesn't yet include endpoints that are specific resource _instances_,
which will follow in a subsequent commit. For the moment that situation
will always indicate a non-match.
2021-07-28 13:33:26 -07:00
James Bardin 86ba49de0c run go mod tidy in CI
Ensure that go.mod and go.sum are correct
2021-07-28 14:55:37 -04:00
James Bardin 667083a70e
Merge pull request #29159 from remilapeyre/update-consul
Update the Consul API client
2021-07-28 14:33:53 -04:00
hc-github-team-tf-core 8097edbd6f Cleanup after v1.1.0-alpha20210728 release 2021-07-28 17:45:46 +00:00
hc-github-team-tf-core a2a466ee0d
Release v1.1.0-alpha20210728 2021-07-28 17:29:28 +00:00
robe007 880f846f43
Remove repeated word 'the' in some lines. 2021-07-28 07:40:07 -06:00
Rémi Lapeyre da6717761e Merge remote-tracking branch 'origin/main' into update-consul 2021-07-28 12:18:01 +02:00
James Bardin fe77d732be
Merge pull request #29251 from hashicorp/jbardin/issue-template
update GH issue template
2021-07-27 13:49:16 -04:00
Martin Atkins 994ee23c06 addrs: Module move support for AbsResource and AbsResourceInstance
This is a subset of the MoveDestination behavior for AbsResource and
AbsResourceInstance which deals with source and destination addresses that
refer to module calls or module instances.

They both work by delegating to ModuleInstance.MoveDestination and then
applying the same resource or resource instance address to the
newly-chosen module instance address, thus ensuring that when we move
a module we also move all of the resources inside that module in the same
way.

This doesn't yet include support for moving between specific resource or
resource instance addresses; that'll follow later. This commit should have
enough logic to support moving between module names and module instance
keys, including any module calls or resources nested within.
2021-07-27 09:13:01 -07:00
Martin Atkins 4d733b4d2d addrs: Implement ModuleInstance.MoveDestination
This method encapsulates the move-processing rules for applying move
statements to ModuleInstance addresses. It honors both module call moves
and module instance moves by trying to find a subsequence of the input
that matches the "from" endpoint and then, if found, replacing it with
the "to" endpoint while preserving the prefix and suffix around the match,
if any.
2021-07-27 09:13:01 -07:00
James Bardin c449148d8c update GH issue template
Change generic provider link to the registry, since the majority of
providers are no longer under the terraform-provider org.

Remove example link to an individual user's repo.
2021-07-27 10:48:09 -04:00
Laura Pacilio 2e82e55268
Merge pull request #29244 from hashicorp/laura-fix-providers-page
Update extending link to "plugin development"
2021-07-26 15:07:58 -04:00
Laura Pacilio a14272d022 Update extending link to "plugin development" 2021-07-26 14:52:44 -04:00
Laura Pacilio f1f2cc6fb1
Merge pull request #29003 from tjabbour/patch-1
fix: Fix typo in provider documentation
2021-07-26 11:45:45 -04:00
Laura Pacilio 7d52e3c473
Merge pull request #29241 from hashicorp/DanielMSchmidt-patch-1
terraform-workspace should be terraform.workspace
2021-07-26 11:34:51 -04:00
Laura Pacilio 282a02de42
Merge pull request #29234 from susenj/patch-2
Conciseness and fixed some typos in apt.html.md
2021-07-26 11:14:59 -04:00
Daniel Schmidt 59dd7f8f51
terraform-workspace should be terraform.workspace
Closes #28881 by @abidmunirmalik
2021-07-26 09:41:51 +02:00
magodo 90e6a3dffb
modify test case 2021-07-26 11:25:47 +08:00
magodo 67afee693b
target resource in module check only when `-out` points to a module 2021-07-24 12:03:32 +08:00
magodo dea645797a
`terraform add -out` append to existing config 2021-07-24 11:35:15 +08:00
Neeraj Kumar 6b0be752bf
Updated line width 2021-07-24 06:58:04 +05:30
Neeraj Kumar 21136cf2fe
Conciseness and fixed some typos in apt.html.md
As discussed with Laura, submitting this PR.
2021-07-24 06:54:44 +05:30
Laura Pacilio e09b831f6e
Merge pull request #28782 from TAYTS/patch-1
Update one.html.md
2021-07-23 16:51:36 -04:00
Laura Pacilio 34c9923692
Merge pull request #28989 from madjava/patch-1
Update configuration.html.md
2021-07-23 16:48:46 -04:00
Laura Pacilio d572ebf387
Merge pull request #28910 from brenwhyte/patch-1
Update configuration.html.md (typo)
2021-07-23 16:47:34 -04:00
Laura Pacilio 08df639a42
Merge pull request #29228 from susenj/patch-1
Minor typo in apt.html.md
2021-07-23 16:45:42 -04:00
Laura Pacilio f590c0f5bc Update metadata for fmt command 2021-07-23 16:35:07 -04:00
Laura Pacilio 5046e38228 Update metadata for env command 2021-07-23 16:33:37 -04:00
Laura Pacilio 027dbe40cd Update metadata for console command 2021-07-23 16:31:43 -04:00
Laura Pacilio ae2ff87598 Updates to page metadata for plan, apply, import, and destroy 2021-07-23 16:30:11 -04:00
Laura Pacilio dc0dd75b60 Update description metadata for import command 2021-07-23 16:28:11 -04:00
Laura Pacilio 2233ef1782 Update description metadata for apply command 2021-07-23 16:26:29 -04:00
Laura Pacilio f0796733c7 Update page metadata for plan command 2021-07-23 16:23:52 -04:00
Laura Pacilio 4a7221d574 Update metadata description on internals overview page 2021-07-23 16:21:41 -04:00
Laura Pacilio 8141af7632 Update description medata on plugin signing page 2021-07-23 16:17:47 -04:00
Laura Pacilio 18b7b4012c Add metadata description to cli configuration file page 2021-07-23 16:15:14 -04:00
Laura Pacilio 03e1818c74 Add description to environment variables page 2021-07-23 16:10:12 -04:00
Laura Pacilio 5399376263 Add description to cli configuration overview page 2021-07-23 16:06:43 -04:00
Laura Pacilio 749d5ce98f Add metadata to managing plugins overview page 2021-07-23 16:04:12 -04:00
Laura Pacilio 2ef32997ab Add metadata to workspace subcommand overview page 2021-07-23 15:57:48 -04:00
Laura Pacilio e432d85c5c Add description metadata to managing workspaces overview page 2021-07-23 15:55:23 -04:00
Laura Pacilio 585b609fff Add page metadata to state recovery page 2021-07-23 15:47:49 -04:00
Laura Pacilio a8ffd119aa Add page metadata to moving resources overview 2021-07-23 14:53:20 -04:00