TerraformOpenVPN icon indicating copy to clipboard operation
TerraformOpenVPN copied to clipboard

Error: Invalid reference from destroy provisioner

Open khadka-prakash opened this issue 4 years ago • 1 comments

Run the following command

terraform plan

You will get the following error

Error: Invalid reference from destroy provisioner

  on instance.tf line 69, in resource "google_compute_instance" "ovpn":
  69:     command = "rm -f ${var.client_config_path}/${var.client_config_name}.ovpn"

Destroy-time provisioners and their connection configurations may only
reference attributes of the related resource, via 'self', 'count.index', or
'each.key'.

References to other resources during the destroy phase can cause dependency
cycles and interact poorly with create_before_destroy.

Terraform version

terraform version
Terraform v0.13.4

Your version of Terraform is out of date! The latest version
is 0.13.5. You can update by downloading from https://www.terraform.io/downloads.html

The cause: https://www.terraform.io/upgrade-guides/0-13.html#destroy-time-provisioners-may-not-refer-to-other-resources

khadka-prakash avatar Oct 28 '20 08:10 khadka-prakash

+1

marcosdeseul avatar Apr 26 '21 02:04 marcosdeseul