Merge pull request #26105 from hashicorp/alisdair/more-interpolation-only-expression-deprecations
configs: More interpolation-only expr deprecations
This commit is contained in:
commit
803c95e552
|
@ -31,6 +31,13 @@ type ModuleCall struct {
|
|||
}
|
||||
|
||||
func decodeModuleBlock(block *hcl.Block, override bool) (*ModuleCall, hcl.Diagnostics) {
|
||||
var diags hcl.Diagnostics
|
||||
|
||||
// Produce deprecation messages for any pre-0.12-style
|
||||
// single-interpolation-only expressions.
|
||||
moreDiags := warnForDeprecatedInterpolationsInBody(block.Body)
|
||||
diags = append(diags, moreDiags...)
|
||||
|
||||
mc := &ModuleCall{
|
||||
Name: block.Labels[0],
|
||||
DeclRange: block.DefRange,
|
||||
|
@ -41,7 +48,8 @@ func decodeModuleBlock(block *hcl.Block, override bool) (*ModuleCall, hcl.Diagno
|
|||
schema = schemaForOverrides(schema)
|
||||
}
|
||||
|
||||
content, remain, diags := block.Body.PartialContent(schema)
|
||||
content, remain, moreDiags := block.Body.PartialContent(schema)
|
||||
diags = append(diags, moreDiags...)
|
||||
mc.Config = remain
|
||||
|
||||
if !hclsyntax.ValidIdentifier(mc.Name) {
|
||||
|
|
|
@ -439,6 +439,8 @@ type Output struct {
|
|||
}
|
||||
|
||||
func decodeOutputBlock(block *hcl.Block, override bool) (*Output, hcl.Diagnostics) {
|
||||
var diags hcl.Diagnostics
|
||||
|
||||
o := &Output{
|
||||
Name: block.Labels[0],
|
||||
DeclRange: block.DefRange,
|
||||
|
@ -449,7 +451,13 @@ func decodeOutputBlock(block *hcl.Block, override bool) (*Output, hcl.Diagnostic
|
|||
schema = schemaForOverrides(schema)
|
||||
}
|
||||
|
||||
content, diags := block.Body.Content(schema)
|
||||
// Produce deprecation messages for any pre-0.12-style
|
||||
// single-interpolation-only expressions.
|
||||
moreDiags := warnForDeprecatedInterpolationsInBody(block.Body)
|
||||
diags = append(diags, moreDiags...)
|
||||
|
||||
content, moreDiags := block.Body.Content(schema)
|
||||
diags = append(diags, moreDiags...)
|
||||
|
||||
if !hclsyntax.ValidIdentifier(o.Name) {
|
||||
diags = append(diags, &hcl.Diagnostic{
|
||||
|
@ -512,6 +520,11 @@ func decodeLocalsBlock(block *hcl.Block) ([]*Local, hcl.Diagnostics) {
|
|||
})
|
||||
}
|
||||
|
||||
// Produce deprecation messages for any pre-0.12-style
|
||||
// single-interpolation-only expressions.
|
||||
moreDiags := warnForDeprecatedInterpolationsInExpr(attr.Expr)
|
||||
diags = append(diags, moreDiags...)
|
||||
|
||||
locals = append(locals, &Local{
|
||||
Name: name,
|
||||
Expr: attr.Expr,
|
||||
|
|
|
@ -290,6 +290,7 @@ func decodeResourceBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
|
|||
}
|
||||
|
||||
func decodeDataBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
|
||||
var diags hcl.Diagnostics
|
||||
r := &Resource{
|
||||
Mode: addrs.DataResourceMode,
|
||||
Type: block.Labels[0],
|
||||
|
@ -298,7 +299,13 @@ func decodeDataBlock(block *hcl.Block) (*Resource, hcl.Diagnostics) {
|
|||
TypeRange: block.LabelRanges[0],
|
||||
}
|
||||
|
||||
content, remain, diags := block.Body.PartialContent(dataBlockSchema)
|
||||
// Produce deprecation messages for any pre-0.12-style
|
||||
// single-interpolation-only expressions.
|
||||
moreDiags := warnForDeprecatedInterpolationsInBody(block.Body)
|
||||
diags = append(diags, moreDiags...)
|
||||
|
||||
content, remain, moreDiags := block.Body.PartialContent(dataBlockSchema)
|
||||
diags = append(diags, moreDiags...)
|
||||
r.Config = remain
|
||||
|
||||
if !hclsyntax.ValidIdentifier(r.Type) {
|
||||
|
|
|
@ -34,3 +34,20 @@ resource "null_resource" "a" {
|
|||
wrapped = ["${var.triggers["greeting"]}"]
|
||||
}
|
||||
}
|
||||
|
||||
module "foo" {
|
||||
source = "./foo"
|
||||
foo = "${var.foo}" # WARNING: Interpolation-only expressions are deprecated
|
||||
}
|
||||
|
||||
data "null_data_source" "b" {
|
||||
has_computed_default = "${var.foo}" # WARNING: Interpolation-only expressions are deprecated
|
||||
}
|
||||
|
||||
output "output" {
|
||||
value = "${var.foo}" # WARNING: Interpolation-only expressions are deprecated
|
||||
}
|
||||
|
||||
locals {
|
||||
foo = "${var.foo}" # WARNING: Interpolation-only expressions are deprecated
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue