Commit Graph

28593 Commits

Author SHA1 Message Date
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 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
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
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
Neeraj Kumar 2b3d6f9929
Minor typo in apt.html.md
As part of this PR, just wanted to have this typo fixed to have a better sense of the sentence.

`apt-add-repository` usually automatically runs `apt update` as part of its work in order to fetch the new package indices, but if it does not, then you will need to do so manually before the packages will be available.


Also, I wanted to rephrase the sentence as below(less wording and more clarity- let me know if this is okay and I can raise a new pull request):


`apt-add-repository` usually automatically runs `apt update` as part of its work to fetch the new package indices, but if it does not, you will need to manually do so before the packages will be available.
2021-07-23 08:13:39 +05:30
Kristin Laemmert 0729e9fdd7
configs/configschema: extend block.AttributeByPath to descend into Objects (#29222)
* configs/configschema: extend block.AttributeByPath to descend into Objects

This commit adds a recursive Object.AttributeByPath function which will step through Attributes with NestedTypes. If an Attribute without a NestedType is encountered while there is still more to the path, it will return nil.
2021-07-22 09:45:33 -04:00
Laura Pacilio b9c0cbb1fd
Merge pull request #29117 from hashicorp/description-metadata-language-docs
Description metadata -  language docs
2021-07-21 16:30:05 -04:00
Laura Pacilio 06a2fdcf9d Merge branch 'main' into description-metadata-language-docs 2021-07-21 16:24:59 -04:00
James Bardin b12502679f
Merge pull request #29208 from hashicorp/jbardin/update-hcl
update hcl v2.10.1
2021-07-21 13:51:02 -04:00
James Bardin 8b6b007f5c
Merge pull request #28916 from Schweinepriester/patch-1
HTTP => HTTPS for two links in README.md
2021-07-21 10:37:28 -04:00
James Bardin 15f99bc445
Merge pull request #29081 from amccaskill/patch-1
error_count
2021-07-21 10:15:36 -04:00
James Bardin aaf03d3251 update test error for hclv2.10.1 2021-07-21 09:09:30 -04:00
James Bardin 6fa04091f5
Merge pull request #29193 from hashicorp/jbardin/ignore-changes-marks
Handle marks on ignore_changes values
2021-07-21 09:05:50 -04:00
James Bardin dfbacdc734 update hcl v2.10.1 2021-07-21 08:59:37 -04:00
Kristin Laemmert 0b827ab6b6
format/diff: fix panic with null map in NestedType attrs (#29206) 2021-07-21 08:51:35 -04:00
James Bardin 07ee689eff update comment and extend test 2021-07-20 16:09:46 -04:00
James Bardin 570b70b02f
Merge pull request #28078 from jasons42/configure-etcdv3-client-max-request-size
Expose etcd client MaxCallSendMsgSize config
2021-07-20 15:49:14 -04:00
James Bardin 8dd722ece0
Merge pull request #29167 from xiaozhu36/xiaozhu
backend/oss: Changes the DescribeEndpoint to DescribeEndpoints to fixes the unsupported sts bug
2021-07-20 15:12:31 -04:00
James Bardin 431aa0280e
Merge pull request #29157 from remilapeyre/unique-constraint
Add uniqueness constraint on workspaces name for the pg backend
2021-07-20 15:11:35 -04:00
Jason Smith 5ff9b7626b Fix broken link
Fix website-link-check failing as https://coreos.com/etcd/ 301's to https://etcd.io/. Updated link to https://etcd.io/.
2021-07-20 14:04:49 -05:00
Jason Smith 162f853841 Document max_request_bytes config 2021-07-20 14:04:47 -05:00
Jason Smith d1608d7a7f Expose etcd client MaxCallSendMsgSize config
The etcdv3 client has a default request send limit of 2.0 MiB. This change
exposes the configuration option to increase that limit enabling larger
state using the etcdv3 backend.

This also requires that the corresponding --max-request-bytes flag be
increased on the server side. The default there is 1.5 MiB.

Fixes https://github.com/hashicorp/terraform/issues/25745
2021-07-20 14:04:45 -05:00
James Bardin 271352620b
Merge pull request #29199 from hashicorp/jbardin/etcd3-unmaintained
etcdv3 backend is unmaintained
2021-07-20 14:30:11 -04:00
James Bardin dd330e5194
Merge pull request #29200 from hashicorp/jbardin/rebase-25554
manual rebase of #25554
2021-07-20 14:29:56 -04:00
James Bardin 017633f000
Merge pull request #28128 from hashicorp/jbardin/etcdv3
StateMgr must be able to return with locked state
2021-07-20 14:27:58 -04:00
James Bardin f418b9cd52 etcdv3 backend is unmaintained
There have been no responses from the codeowner for this backend, so
moving to Unmaintained status.
2021-07-20 13:59:08 -04:00
Kevin Burke c047958b57 go.mod,backend: update coreos/etcd dependency to release-3.4 branch
etcd rewrote its import path from coreos/etcd to go.etcd.io/etcd.
Changed the imports path in this commit, which also updates the code
version.

This lets us remove the github.com/ugorji/go/codec dependency, which
was pinned to a fairly old version. The net change is a loss of 30,000
lines of code in the vendor directory. (I first noticed this problem
because the outdated go/codec dependency was causing a dependency
failure when I tried to put Terraform and another project in the same
vendor directory.)

Note the version shows up funkily in go.mod, but I verified
visually it's the same commit as the "release-3.4" tag in
github.com/coreos/etcd. The etcd team plans to fix the release version
tagging in v3.5, which should be released soon.
2021-07-20 12:27:22 -04:00
James Bardin 9c20ed6185 StateMgr must be able to return with locked state
The current usage of internal remote state backends requires that
`StateMgr` be able to return an instance of `statemgr.Full` even if the
state is currently locked.
2021-07-20 12:10:34 -04:00
James Bardin 66a5950acb ignored value in this test should not be marked 2021-07-19 16:42:26 -04:00