Terraform: Terraform Validate does not throw warnings for deprecated syntax inside modules

Created on 29 Jun 2020  ยท  4Comments  ยท  Source: hashicorp/terraform

Terraform Version

Tested on multiple 0.12 versions, current version is 0.12.23

Terraform Configuration Files

I would expect the following foo = "${var.hello}" to throw a deprecation warning, but none is shown
Repository created here https://github.com/Jimmyscene/terraform_bug

module "foo" {
  source = "../foo"
  foo    = "${var.hello}" # THIS DOES NOT ERROR?
}

Debug Output

https://gist.github.com/Jimmyscene/41408d647e1d31955d09774de5e7a0af

Expected Behavior

Warning: Interpolation-only expressions are deprecated

  on ../bar/main.tf line 6, in provider "null":
   7:  foo    = "${var.hello}" # THIS DOES NOT ERROR?

  on ../foo/main.tf line 6, in provider "null":
   6:   acceptable = "${var.foo}" # WARNING: Interpolation-only expressions are deprecated

Actual Behavior

Warning: Interpolation-only expressions are deprecated

  on ../foo/main.tf line 6, in provider "null":
   6:   acceptable = "${var.foo}" # WARNING: Interpolation-only expressions are deprecated

Steps to Reproduce

  1. Clone down repository linked above
  2. cd bar
  3. terraform init
  4. terraform validate
bug config confirmed v0.12

All 4 comments

Hi @Jimmyscene,

It's true that right now this warning only applies to resource and provider blocks. It may be added for other blocks in future, but the warning as implemented currently was intended primarily as a prompt for folks finding outdated examples in old blog posts, documentation, etc and so we focused on the two most common situations when implementing the warning.

Technically this is working as intended -- it was intentionally only implemented for these two blocks so far -- but it feels weird to mark a deprecation warning as an "enhancement" so I'm going to label this as a bug in the configuration package and we can decide what to do about it at a later time. We generally add new deprecation warnings only later in a major release cycle so folks don't have to change lots of unrelated stuff as part of upgrading to a major release, and 0.13.0 is due in a few weeks so we'll need to wait a little while before potentially adding more deprecation warnings of this type.

Thanks for reporting this!

Hey @apparentlymart - Thanks for the quick reply, what's you've said makes sense. Its my understanding that this syntax will be deprecated in 0.13.0. Is that correct?

The syntax is already deprecated in the sense that it's not recommended in the documentation. There won't be any new deprecation _warnings_ in 0.13.0, but new warnings may be added in a later 0.13.x release to make the existing deprecations more explicit.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rjinski picture rjinski  ยท  3Comments

rjinski picture rjinski  ยท  3Comments

ketzacoatl picture ketzacoatl  ยท  3Comments

allomov picture allomov  ยท  3Comments

zeninfinity picture zeninfinity  ยท  3Comments