Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation Warning For Outputs #36016

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dbanck
Copy link
Member

@dbanck dbanck commented Nov 15, 2024

In this PR @DanielMSchmidt and I take a first stab at #18381 and add a new attribute to the output block to allow it to be marked as deprecated.

UX

CleanShot 2024-11-15 at 18 08 51@2x

If this is the right approach, my suggestion would be to deal with the deprecation of inputs in a separate PR.

Partially resolves #18381

Target Release

1.11.x

@jbardin
Copy link
Member

jbardin commented Nov 22, 2024

The reason we don't have deprecation warnings in outputs is really the same reason we don't have deprecation warnings for resource attributes, there is no way to track value provenance. The approach taken here will flag every use of the module value as triggering the deprecation, rather than just use of the deprecated output value.

When references are evaluated in Terraform, they are always evaluated by getting the entire container of values because any indices need to be evaluated as part of the larger expression. So when you reference a module output, you actually obtain an object containing all outputs; and further if the module is expanded, you get a container of all module objects.

The easiest problem to see may be a reference like this:

attr = module.test[*].not_deprecated

The base reference is to the entire tuple of module objects (module.test), even though you only assign the not_deprecated output.

There are a lot of other similar use cases, like passing module object around as arguments themselves should not trigger deprecation warnings if the deprecated output values are never used.

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

Successfully merging this pull request may close these issues.

Deprecation Warning For Input/Output Variables
3 participants