Commit graph

12 commits

Author SHA1 Message Date
Radek Simko
0fe906fa8c make copyrightfix 2026-02-17 13:56:34 +00:00
Kristin Laemmert
76a9aa288b
fix: move parsing action reference expressions into terraform (#37458)
* properly parse actions during configuration loading
* parse action expression during ActionPlanTransformer transform
* fix: properly parse action expressions (not traversals)

Previously, we were storing action and linkedResource expressions as Traversals during config loading. This PR replaces those fields with hcl.Expression, moves some validation around to account for the fact we don't have fully evaluated traversals yet (some checks have been removed entirely and will be replaced in a follow up PR, I wanted to get this right first), and finally moves the actual evaluation into the terraform graph build phase.

 I added a permissive parsing of the ActionExpression during ActionPlanTransformer.transformSingle (to get the config action) and store the action expression inside the nodeActionTriggerPlanExpand.lifecycleActionTrigger so it can be fully evaluated (with access to the resource's repetition data, which is necessary if the action in the resource's lifecycle block uses count.index or for_each.key) during nodeActionTriggerPlanExpand.DynamicExpand
2025-08-22 11:23:55 -04:00
Martin Atkins
545980d664 langrefs: Separate package for expression reference analysis
Finding references in an expression is a static analysis operation, but
we previously had it grouped in with "package lang" that primarily deals
with dynamic evaluation of expressions.

We need to do static analysis in far more locations than we do full
expression evaluation, the static-analysis-only callers don't need anything
else from package lang, and the reference-analysis functions are
self-contained little wrappers around the address parsing logic in
package addrs anyway.

Splitting these into a separate package therefore minimizes which packages
depend indirectly on package lang, and thus which packages depend
indirectly on the implementations of the built-in functions. Some of the
built-in functions rely on dependencies we don't use anywhere else, so
cutting these out shrinks how many packages indirectly depend on those
external dependencies. In particular, they are no longer in the indirect
import chain for the "legacy" module.
2024-03-12 08:43:55 -07:00
hashicorp-copywrite[bot]
53c34ff49c
Update copyright file headers to BUSL-1.1 2023-08-10 23:43:27 +01:00
Liam Cervante
212ae6c4ba
Introduce separate testing scope for reference validation (#33339) 2023-06-28 09:47:24 +02:00
hashicorp-copywrite[bot]
325d18262e [COMPLIANCE] Add Copyright and License Headers 2023-05-02 15:33:06 +00:00
James Bardin
ac2a870ea0 allow json output to marshal ConfigModeAttr blocks
In order to marshal config blocks using ConfigModeAttr, we need to
insert the fixup body to map hcl blocks to the attribute in the schema.
2021-09-03 13:53:52 -04:00
Martin Atkins
ab350289ab addrs: Rename AbsModuleCallOutput to ModuleCallInstanceOutput
The previous name didn't fit with the naming scheme for addrs types:
The "Abs" prefix typically means that it's an addrs.ModuleInstance
combined with whatever type name appears after "Abs", but this is instead
a ModuleCallOutput combined with an InstanceKey, albeit structured the
other way around for convenience, and so the expected name for this would
be the suffix "Instance".

We don't have an "Abs" type corresponding with this one because it would
represent no additional information than AbsOutputValue.
2021-07-01 08:28:02 -07:00
Kristin Laemmert
329585d07d
jsonconfig: properly unwind and enumerate references (#28884)
The "references" included in the expression representation now properly unwrap for each traversal step, to match what was documented.
2021-06-14 09:22:22 -04:00
Martin Atkins
cdd9464f9a Move lang/ to internal/lang/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
31349a9c3a Move configs/ to internal/configs/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Martin Atkins
ffe056bacb Move command/ to internal/command/
This is part of a general effort to move all of Terraform's non-library
package surface under internal in order to reinforce that these are for
internal use within Terraform only.

If you were previously importing packages under this prefix into an
external codebase, you could pin to an earlier release tag as an interim
solution until you've make a plan to achieve the same functionality some
other way.
2021-05-17 14:09:07 -07:00
Renamed from command/jsonconfig/expression.go (Browse further)