Skip to content

Commit d35bc05

Browse files
Update various non-code references to renamed Go packages
Previous commits have moved all of our Go packages under "internal", so this is a retroactive update of non-Go references to those same packages.
1 parent 36d0a50 commit d35bc05

5 files changed

Lines changed: 48 additions & 48 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
- run:
9494
name: Run Go E2E Tests
9595
command: |
96-
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -p 2 -cover -coverprofile=cov_e2e.part ./command/e2etest ./tools/terraform-bundle/e2etest
96+
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -p 2 -cover -coverprofile=cov_e2e.part ./internal/command/e2etest ./tools/terraform-bundle/e2etest
9797
9898
# save coverage report parts
9999
- persist_to_workspace:

‎Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ generate:
1616
protobuf:
1717
bash scripts/protobuf-check.sh
1818
bash internal/tfplugin5/generate.sh
19-
bash plans/internal/planproto/generate.sh
19+
bash internal/plans/internal/planproto/generate.sh
2020

2121
fmtcheck:
2222
@sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'"

‎docs/architecture.md‎

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ in more detail in a corresponding section below.
2323
Each time a user runs the `terraform` program, aside from some initial
2424
bootstrapping in the root package (not shown in the diagram) execution
2525
transfers immediately into one of the "command" implementations in
26-
[the `command` package](https://pkg.go.dev/github.com/hashicorp/terraform/command).
26+
[the `command` package](https://pkg.go.dev/github.com/hashicorp/terraform/internal/command).
2727
The mapping between the user-facing command names and
2828
their corresponding `command` package types can be found in the `commands.go`
2929
file in the root of the repository.
@@ -35,7 +35,7 @@ but it applies to the main Terraform workflow commands `terraform plan` and
3535
For these commands, the role of the command implementation is to read and parse
3636
any command line arguments, command line options, and environment variables
3737
that are needed for the given command and use them to produce a
38-
[`backend.Operation`](https://pkg.go.dev/github.com/hashicorp/terraform/backend#Operation)
38+
[`backend.Operation`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/backend#Operation)
3939
object that describes an action to be taken.
4040

4141
An _operation_ consists of:
@@ -52,18 +52,18 @@ An _operation_ consists of:
5252
The operation is then passed to the currently-selected
5353
[backend](https://www.terraform.io/docs/backends/index.html). Each backend name
5454
corresponds to an implementation of
55-
[`backend.Backend`](https://pkg.go.dev/github.com/hashicorp/terraform/backend#Backend), using a
55+
[`backend.Backend`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/backend#Backend), using a
5656
mapping table in
57-
[the `backend/init` package](https://pkg.go.dev/github.com/hashicorp/terraform/backend/init).
57+
[the `backend/init` package](https://pkg.go.dev/github.com/hashicorp/terraform/internal/backend/init).
5858

5959
Backends that are able to execute operations additionally implement
60-
[`backend.Enhanced`](https://pkg.go.dev/github.com/hashicorp/terraform/backend#Enhanced);
60+
[`backend.Enhanced`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/backend#Enhanced);
6161
the command-handling code calls `Operation` with the operation it has
6262
constructed, and then the backend is responsible for executing that action.
6363

6464
Most backends do _not_ implement this interface, and so the `command` package
6565
wraps these backends in an instance of
66-
[`local.Local`](https://pkg.go.dev/github.com/hashicorp/terraform/backend/local#Local),
66+
[`local.Local`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/backend/local#Local),
6767
causing the operation to be executed locally within the `terraform` process
6868
itself, which (at the time of writing) is currently the only way an operation
6969
can be executed.
@@ -85,41 +85,41 @@ elsewhere.
8585

8686
To execute an operation locally, the `local` backend uses a _state manager_
8787
(either
88-
[`statemgr.Filesystem`](https://pkg.go.dev/github.com/hashicorp/terraform/states/statemgr#Filesystem) if the
88+
[`statemgr.Filesystem`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/states/statemgr#Filesystem) if the
8989
local backend is being used directly, or an implementation provided by whatever
9090
backend is being wrapped) to retrieve the current state for the workspace
9191
specified in the operation, then uses the _config loader_ to load and do
9292
initial processing/validation of the configuration specified in the
9393
operation. It then uses these, along with the other settings given in the
9494
operation, to construct a
95-
[`terraform.Context`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#Context),
95+
[`terraform.Context`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#Context),
9696
which is the main object that actually performs Terraform operations.
9797

9898
The `local` backend finally calls an appropriate method on that context to
9999
begin execution of the relevant command, such as
100-
[`Plan`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#Context.Plan)
100+
[`Plan`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#Context.Plan)
101101
or
102102
[`Apply`](), which in turn constructs a graph using a _graph builder_,
103103
described in a later section.
104104

105105
## Configuration Loader
106106

107107
The top-level configuration structure is represented by model types in
108-
[package `configs`](https://pkg.go.dev/github.com/hashicorp/terraform/configs).
108+
[package `configs`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/configs).
109109
A whole configuration (the root module plus all of its descendent modules)
110110
is represented by
111-
[`configs.Config`](https://pkg.go.dev/github.com/hashicorp/terraform/configs#Config).
111+
[`configs.Config`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/configs#Config).
112112

113113
The `configs` package contains some low-level functionality for constructing
114114
configuration objects, but the main entry point is in the sub-package
115-
[`configload`](https://pkg.go.dev/github.com/hashicorp/terraform/configs/configload]),
115+
[`configload`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/configs/configload]),
116116
via
117-
[`configload.Loader`](https://pkg.go.dev/github.com/hashicorp/terraform/configs/configload#Loader).
117+
[`configload.Loader`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/configs/configload#Loader).
118118
A loader deals with all of the details of installing child modules
119119
(during `terraform init`) and then locating those modules again when a
120120
configuration is loaded by a backend. It takes the path to a root module
121121
and recursively loads all of the child modules to produce a single
122-
[`configs.Config`](https://pkg.go.dev/github.com/hashicorp/terraform/configs#Config)
122+
[`configs.Config`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/configs#Config)
123123
representing the entire configuration.
124124

125125
Terraform expects configuration files written in the Terraform language, which
@@ -139,17 +139,17 @@ A _state manager_ is responsible for storing and retrieving snapshots of the
139139
[Terraform state](https://www.terraform.io/docs/language/state/index.html)
140140
for a particular workspace. Each manager is an implementation of
141141
some combination of interfaces in
142-
[the `statemgr` package](https://pkg.go.dev/github.com/hashicorp/terraform/states/statemgr),
142+
[the `statemgr` package](https://pkg.go.dev/github.com/hashicorp/terraform/internal/states/statemgr),
143143
with most practical managers implementing the full set of operations
144144
described by
145-
[`statemgr.Full`](https://pkg.go.dev/github.com/hashicorp/terraform/states/statemgr#Full)
145+
[`statemgr.Full`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/states/statemgr#Full)
146146
provided by a _backend_. The smaller interfaces exist primarily for use in
147147
other function signatures to be explicit about what actions the function might
148148
take on the state manager; there is little reason to write a state manager
149149
that does not implement all of `statemgr.Full`.
150150

151151
The implementation
152-
[`statemgr.Filesystem`](https://pkg.go.dev/github.com/hashicorp/terraform/states/statemgr#Filesystem) is used
152+
[`statemgr.Filesystem`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/states/statemgr#Filesystem) is used
153153
by default (by the `local` backend) and is responsible for the familiar
154154
`terraform.tfstate` local file that most Terraform users start with, before
155155
they switch to [remote state](https://www.terraform.io/docs/language/state/remote.html).
@@ -158,7 +158,7 @@ Each of these saves and retrieves state via a remote network service
158158
appropriate to the backend that creates it.
159159

160160
A state manager accepts and returns a state snapshot as a
161-
[`states.State`](https://pkg.go.dev/github.com/hashicorp/terraform/states#State)
161+
[`states.State`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/states#State)
162162
object. The state manager is responsible for exactly how that object is
163163
serialized and stored, but all state managers at the time of writing use
164164
the same JSON serialization format, storing the resulting JSON bytes in some
@@ -167,7 +167,7 @@ kind of arbitrary blob store.
167167
## Graph Builder
168168

169169
A _graph builder_ is called by a
170-
[`terraform.Context`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#Context)
170+
[`terraform.Context`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#Context)
171171
method (e.g. `Plan` or `Apply`) to produce the graph that will be used
172172
to represent the necessary steps for that operation and the dependency
173173
relationships between them.
@@ -177,7 +177,7 @@ In most cases, the
177177
graphs each represent a specific object in the configuration, or something
178178
derived from those configuration objects. For example, each `resource` block
179179
in the configuration has one corresponding
180-
[`GraphNodeConfigResource`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#GraphNodeConfigResource)
180+
[`GraphNodeConfigResource`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#GraphNodeConfigResource)
181181
vertex representing it in the "plan" graph. (Terraform Core uses terminology
182182
inconsistently, describing graph _vertices_ also as graph _nodes_ in various
183183
places. These both describe the same concept.)
@@ -194,23 +194,23 @@ graph from the set of changes described in the plan that is being applied.
194194

195195
The graph builders all work in terms of a sequence of _transforms_, which
196196
are implementations of
197-
[`terraform.GraphTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#GraphTransformer).
197+
[`terraform.GraphTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#GraphTransformer).
198198
Implementations of this interface just take a graph and mutate it in any
199199
way needed, and so the set of available transforms is quite varied. Some
200200
important examples include:
201201

202-
* [`ConfigTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#ConfigTransformer),
202+
* [`ConfigTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#ConfigTransformer),
203203
which creates a graph vertex for each `resource` block in the configuration.
204204

205-
* [`StateTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#StateTransformer),
205+
* [`StateTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#StateTransformer),
206206
which creates a graph vertex for each resource instance currently tracked
207207
in the state.
208208

209-
* [`ReferenceTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#ReferenceTransformer),
209+
* [`ReferenceTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#ReferenceTransformer),
210210
which analyses the configuration to find dependencies between resources and
211211
other objects and creates any necessary "happens after" edges for these.
212212

213-
* [`ProviderTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#ProviderTransformer),
213+
* [`ProviderTransformer`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#ProviderTransformer),
214214
which associates each resource or resource instance with exactly one
215215
provider configuration (implementing
216216
[the inheritance rules](https://www.terraform.io/docs/language/modules/develop/providers.html))
@@ -224,25 +224,25 @@ builder uses a different subset of these depending on the needs of the
224224
operation that is being performed.
225225

226226
The result of graph building is a
227-
[`terraform.Graph`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#Graph), which
227+
[`terraform.Graph`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#Graph), which
228228
can then be processed using a _graph walker_.
229229

230230
## Graph Walk
231231

232232
The process of walking the graph visits each vertex of that graph in a way
233233
which respects the "happens after" edges in the graph. The walk algorithm
234234
itself is implemented in
235-
[the low-level `dag` package](https://pkg.go.dev/github.com/hashicorp/terraform/dag#AcyclicGraph.Walk)
235+
[the low-level `dag` package](https://pkg.go.dev/github.com/hashicorp/terraform/internal/dag#AcyclicGraph.Walk)
236236
(where "DAG" is short for [_Directed Acyclic Graph_](https://en.wikipedia.org/wiki/Directed_acyclic_graph)), in
237-
[`AcyclicGraph.Walk`](https://pkg.go.dev/github.com/hashicorp/terraform/dag#AcyclicGraph.Walk).
237+
[`AcyclicGraph.Walk`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/dag#AcyclicGraph.Walk).
238238
However, the "interesting" Terraform walk functionality is implemented in
239-
[`terraform.ContextGraphWalker`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#ContextGraphWalker),
239+
[`terraform.ContextGraphWalker`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#ContextGraphWalker),
240240
which implements a small set of higher-level operations that are performed
241241
during the graph walk:
242242

243243
* `EnterPath` is called once for each module in the configuration, taking a
244244
module address and returning a
245-
[`terraform.EvalContext`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#EvalContext)
245+
[`terraform.EvalContext`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#EvalContext)
246246
that tracks objects within that module. `terraform.Context` is the _global_
247247
context for the entire operation, while `terraform.EvalContext` is a
248248
context for processing within a single module, and is the primary means
@@ -254,7 +254,7 @@ will evaluate multiple vertices concurrently. Vertex evaluation code must
254254
therefore make careful use of concurrency primitives such as mutexes in order
255255
to coordinate access to shared objects such as the `states.State` object.
256256
In most cases, we use the helper wrapper
257-
[`states.SyncState`](https://pkg.go.dev/github.com/hashicorp/terraform/states#SyncState)
257+
[`states.SyncState`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/states#SyncState)
258258
to safely implement concurrent reads and writes from the shared state.
259259

260260
## Vertex Evaluation
@@ -287,27 +287,27 @@ a plan operation would include the following high-level steps:
287287
this operation.
288288

289289
Each execution step for a vertex is an implementation of
290-
[`terraform.Execute`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#Execute).
290+
[`terraform.Execute`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/erraform#Execute).
291291
As with graph transforms, the behavior of these implementations varies widely:
292292
whereas graph transforms can take any action against the graph, an `Execute`
293293
implementation can take any action against the `EvalContext`.
294294

295295
The implementation of `terraform.EvalContext` used in real processing
296296
(as opposed to testing) is
297-
[`terraform.BuiltinEvalContext`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#BuiltinEvalContext).
297+
[`terraform.BuiltinEvalContext`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#BuiltinEvalContext).
298298
It provides coordinated access to plugins, the current state, and the current
299299
plan via the `EvalContext` interface methods.
300300

301301
In order to be executed, a vertex must implement
302-
[`terraform.GraphNodeExecutable`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#GraphNodeExecutable),
302+
[`terraform.GraphNodeExecutable`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#GraphNodeExecutable),
303303
which has a single `Execute` method that handles. There are numerous `Execute`
304304
implementations with different behaviors, but some prominent examples are:
305305

306-
* [NodePlannableResource.Execute](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#NodePlannableResourceInstance.Execute), which handles the `plan` operation.
306+
* [NodePlannableResource.Execute](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#NodePlannableResourceInstance.Execute), which handles the `plan` operation.
307307

308-
* [`NodeApplyableResourceInstance.Execute`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#NodeApplyableResourceInstance.Execute), which handles the main `apply` operation.
308+
* [`NodeApplyableResourceInstance.Execute`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#NodeApplyableResourceInstance.Execute), which handles the main `apply` operation.
309309

310-
* [`NodeDestroyResourceInstance.Execute`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#EvalWriteState), which handles the main `destroy` operation.
310+
* [`NodeDestroyResourceInstance.Execute`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#EvalWriteState), which handles the main `destroy` operation.
311311

312312
A vertex must complete successfully before the graph walk will begin evaluation
313313
for other vertices that have "happens after" edges. Evaluation can fail with one
@@ -327,11 +327,11 @@ The high-level process for expression evaluation is:
327327
to. For example, the expression `aws_instance.example[1]` refers to one of
328328
the instances created by a `resource "aws_instance" "example"` block in
329329
configuration. This analysis is performed by
330-
[`lang.References`](https://pkg.go.dev/github.com/hashicorp/terraform/lang#References),
330+
[`lang.References`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/lang#References),
331331
or more often one of the helper wrappers around it:
332-
[`lang.ReferencesInBlock`](https://pkg.go.dev/github.com/hashicorp/terraform/lang#ReferencesInBlock)
332+
[`lang.ReferencesInBlock`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/lang#ReferencesInBlock)
333333
or
334-
[`lang.ReferencesInExpr`](https://pkg.go.dev/github.com/hashicorp/terraform/lang#ReferencesInExpr)
334+
[`lang.ReferencesInExpr`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/lang#ReferencesInExpr)
335335

336336
1. Retrieve from the state the data for the objects that are referred to and
337337
create a lookup table of the values from these objects that the
@@ -345,11 +345,11 @@ The high-level process for expression evaluation is:
345345
object) against the data and function lookup tables.
346346

347347
In practice, steps 2 through 4 are usually run all together using one
348-
of the methods on [`lang.Scope`](https://pkg.go.dev/github.com/hashicorp/terraform/lang#Scope);
348+
of the methods on [`lang.Scope`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/lang#Scope);
349349
most commonly,
350-
[`lang.EvalBlock`](https://pkg.go.dev/github.com/hashicorp/terraform/lang#Scope.EvalBlock)
350+
[`lang.EvalBlock`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/lang#Scope.EvalBlock)
351351
or
352-
[`lang.EvalExpr`](https://pkg.go.dev/github.com/hashicorp/terraform/lang#Scope.EvalExpr).
352+
[`lang.EvalExpr`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/lang#Scope.EvalExpr).
353353

354354
Expression evaluation produces a dynamic value represented as a
355355
[`cty.Value`](https://pkg.go.dev/github.com/zclconf/go-cty/cty#Value).
@@ -374,7 +374,7 @@ known when the main graph is constructed, but become known while evaluating
374374
other vertices in the main graph.
375375

376376
This special behavior applies to vertex objects that implement
377-
[`terraform.GraphNodeDynamicExpandable`](https://pkg.go.dev/github.com/hashicorp/terraform/terraform#GraphNodeDynamicExpandable).
377+
[`terraform.GraphNodeDynamicExpandable`](https://pkg.go.dev/github.com/hashicorp/terraform/internal/terraform#GraphNodeDynamicExpandable).
378378
Such vertices have their own nested _graph builder_, _graph walk_,
379379
and _vertex evaluation_ steps, with the same behaviors as described in these
380380
sections for the main graph. The difference is in which graph transforms

0 commit comments

Comments
 (0)