From edc670d0791a95ae76ce7cb4f10fb629e7f9f8d4 Mon Sep 17 00:00:00 2001 From: Pam Selle <204372+pselle@users.noreply.github.com> Date: Wed, 26 Aug 2020 10:46:04 -0400 Subject: [PATCH 1/2] Add deprecation warning for vendor provisioners Adds a warning for chef, habitat, puppet, and salt-masterless provisioners, and a corresponding test file to test for the warning --- configs/provisioner.go | 10 ++++++++++ configs/testdata/warning-files/vendor_provisioners.tf | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 configs/testdata/warning-files/vendor_provisioners.tf diff --git a/configs/provisioner.go b/configs/provisioner.go index 7693825139..5b664d39b9 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 0000000000..7da591df61 --- /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 +} From 5153ea633bb6e58939267a83fef44204aaa81a68 Mon Sep 17 00:00:00 2001 From: Pam Selle <204372+pselle@users.noreply.github.com> Date: Fri, 28 Aug 2020 12:25:56 -0400 Subject: [PATCH 2/2] Add docs notes for deprecation --- website/docs/provisioners/chef.html.markdown | 5 +++-- website/docs/provisioners/habitat.html.markdown | 5 +++-- website/docs/provisioners/puppet.html.markdown | 5 +++-- website/docs/provisioners/salt-masterless.html.md | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/website/docs/provisioners/chef.html.markdown b/website/docs/provisioners/chef.html.markdown index 8056f297f8..c4ab30f5d7 100644 --- a/website/docs/provisioners/chef.html.markdown +++ b/website/docs/provisioners/chef.html.markdown @@ -12,8 +12,9 @@ The `chef` provisioner installs, configures and runs the Chef Client on a remote resource. The `chef` provisioner supports both `ssh` and `winrm` type [connections](/docs/provisioners/connection.html). --> **Note:** Provisioners should only be used as a last resort. For most -common situations there are better alternatives. For more information, see +-> **Note:** This provisioner has been deprecated as of Terraform 0.13.3 and will be +removed in a future version of Terraform. For most common situations there are better +alternatives to using provisioners. For more information, see [the main Provisioners page](./). ## Requirements diff --git a/website/docs/provisioners/habitat.html.markdown b/website/docs/provisioners/habitat.html.markdown index 2c2da61466..e2100aafb6 100644 --- a/website/docs/provisioners/habitat.html.markdown +++ b/website/docs/provisioners/habitat.html.markdown @@ -10,8 +10,9 @@ description: |- The `habitat` provisioner installs the [Habitat](https://habitat.sh) supervisor and loads configured services. This provisioner only supports Linux targets using the `ssh` connection type at this time. --> **Note:** Provisioners should only be used as a last resort. For most -common situations there are better alternatives. For more information, see +-> **Note:** This provisioner has been deprecated as of Terraform 0.13.3 and will be +removed in a future version of Terraform. For most common situations there are better +alternatives to using provisioners. For more information, see [the main Provisioners page](./). ## Requirements diff --git a/website/docs/provisioners/puppet.html.markdown b/website/docs/provisioners/puppet.html.markdown index 844671b54a..2b4b02746e 100644 --- a/website/docs/provisioners/puppet.html.markdown +++ b/website/docs/provisioners/puppet.html.markdown @@ -12,8 +12,9 @@ The `puppet` provisioner installs, configures and runs the Puppet agent on a remote resource. The `puppet` provisioner supports both `ssh` and `winrm` type [connections](/docs/provisioners/connection.html). --> **Note:** Provisioners should only be used as a last resort. For most -common situations there are better alternatives. For more information, see +-> **Note:** This provisioner has been deprecated as of Terraform 0.13.3 and will be +removed in a future version of Terraform. For most common situations there are better +alternatives to using provisioners. For more information, see [the main Provisioners page](./). ## Requirements diff --git a/website/docs/provisioners/salt-masterless.html.md b/website/docs/provisioners/salt-masterless.html.md index a502749061..3da71c54cf 100644 --- a/website/docs/provisioners/salt-masterless.html.md +++ b/website/docs/provisioners/salt-masterless.html.md @@ -13,8 +13,9 @@ Type: `salt-masterless` The `salt-masterless` Terraform provisioner provisions machines built by Terraform using [Salt](http://saltstack.com/) states, without connecting to a Salt master. The `salt-masterless` provisioner supports `ssh` [connections](/docs/provisioners/connection.html). --> **Note:** Provisioners should only be used as a last resort. For most -common situations there are better alternatives. For more information, see +-> **Note:** This provisioner has been deprecated as of Terraform 0.13.3 and will be +removed in a future version of Terraform. For most common situations there are better +alternatives to using provisioners. For more information, see [the main Provisioners page](./). ## Requirements