diff --git a/configs/provisioner.go b/configs/provisioner.go index 769382513..5b664d39b 100644 --- a/configs/provisioner.go +++ b/configs/provisioner.go @@ -31,6 +31,16 @@ func decodeProvisionerBlock(block *hcl.Block) (*Provisioner, hcl.Diagnostics) { content, config, diags := block.Body.PartialContent(provisionerBlockSchema) pv.Config = config + switch pv.Type { + case "chef", "habitat", "puppet", "salt-masterless": + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagWarning, + Summary: fmt.Sprintf("The \"%s\" provisioner is deprecated", pv.Type), + Detail: fmt.Sprintf("The \"%s\" provisioner is deprecated and will be removed from future versions of Terraform. Visit https://learn.hashicorp.com/collections/terraform/provision for alternatives to using provisioners that are a better fit for the Terraform workflow.", pv.Type), + Subject: &pv.TypeRange, + }) + } + if attr, exists := content.Attributes["when"]; exists { expr, shimDiags := shimTraversalInString(attr.Expr, true) diags = append(diags, shimDiags...) diff --git a/configs/testdata/warning-files/vendor_provisioners.tf b/configs/testdata/warning-files/vendor_provisioners.tf new file mode 100644 index 000000000..7da591df6 --- /dev/null +++ b/configs/testdata/warning-files/vendor_provisioners.tf @@ -0,0 +1,3 @@ +resource "null_resource" "test" { + provisioner "habitat" {} # WARNING: The "habitat" provisioner is deprecated +}