Files
opentf/internal/legacy/hcl2shim/doc.go
Martin Atkins 868dc2f01b hcl2shim: Split out legacy subset
Due to some past confusion about the purpose of this package, it has grown
to include a confusing mix of currently-viable code and legacy support
code from the move to HCL 2. This has in turn caused confusion about which
parts of this package _should_ be used for new code.

To help clarify that distinction we'll move the legacy support code into
a package under the "legacy" directory, which is also where most of its
callers live.

There are unfortunately still some callers to these outside of the legacy
tree, but the vast majority are either old tests written before HCL 2
adoption or helper code used only by those tests. The one dubious exception
is the use in ResourceInstanceObjectSrc.Decode, which makes a best effort
to shim flatmap as a concession to the fact that not all state-loading
codepaths are able to run the provider state upgrade function that would
normally be responsible for the flatmap-to-JSON conversion, which is
explained in a new comment inline.

Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
2025-07-10 08:13:25 -07:00

19 lines
835 B
Go

// Copyright (c) The OpenTofu Authors
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2023 HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
// Package hcl2shim contains a small number of "shimming" utilities that the
// other packages under internal/legacy use to adapt from HCL 2 concepts to
// legacy concepts.
//
// It's unfortunately also used in support of some very old tests in non-legacy
// packages that were originally written against the legacy packages, which are
// preserved in their current form for now to ensure that they keep testing what
// they were originally intended to test, but will hopefully be gradually
// modernized over time as they get updated for other reasons.
//
// Nothing in this package should be used in new code. It's here only to keep
// the other legacy code working.
package hcl2shim