Skip to content

Conversation

@DanielMSchmidt
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt commented Dec 11, 2025

This PR prepares deprecations as a concept in TF. For the full end-to-end implementation see #37795, this PR splits up that work into more reviewable chunks.

Fixes #

Target Release

1.15.x

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@DanielMSchmidt DanielMSchmidt requested a review from a team as a code owner December 11, 2025 12:44
@DanielMSchmidt DanielMSchmidt added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Dec 11, 2025

type DeprecationMark struct {
Message string
Origin *hcl.Range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try tracking some source address and attribute path info here, maybe something like a globalref.Reference? While we can render the source position once the diagnostic is printed, that doesn't directly tell the user which type and attribute path is being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently the origin is sort of unused, we just show the expression containing the mark where it is used. I wanted to do a bit more work towards a good error message that show both where it's used and the origin, but that is more aspirational. I could remove origin for now while it's unused?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe we leave it out for now, rather than have a half-solution. Maybe because we render these at the first point of usage, there's enough context for users to know where the problematic source is?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think so. I definitely want to do a spike on a nice "this is the usage and this over here is the origin of the mark" diagnostic message but I haven't had the time and energy to delve into that yet 😅

we will add sth like this again when we will be able display a nicer diagnostic with the origin
Comment on lines +107 to +108
var Deprecation = NewDeprecation("")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for this to be a public API? If it is only used internally to type-check, then maybe not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to be, so that you can do e.g. marks.Has(value, marks.Deprecation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants