Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Terraform destroy doesn't work #93

Open
VincenzoDo opened this issue Oct 10, 2018 · 12 comments
Open

Terraform destroy doesn't work #93

VincenzoDo opened this issue Oct 10, 2018 · 12 comments

Comments

@VincenzoDo
Copy link

VincenzoDo commented Oct 10, 2018

Hello,

as the title states I'm not able to destroy a VM using the plugin. No log output is written to vra-terraform.log during the destroy operation, so I enabled terraform debug logging which is attached here.
tflog.txt

TF file:

provider "vra7" {
  username = "${var.vra_username}"
  password = "${var.vra_password}"
  tenant   = "${var.vra_tenant}"
  host     = "${var.vra_host}"
  insecure = "true"

}

resource "vra7_resource" "example_machine1" {
   catalog_name = "base"
   businessgroup_id = "dfaa1892-f422-425f-99c6-12345678"

   resource_configuration = {
        base.cpu = "2"
	base.memory = "2048"
        base.Linux.Hostname = "myvm"
        base.Linux.RootPassword = "mypassword"
        base.VirtualMachine.Network0.Name = "mynetwork"
     }

}

Expected Behavior

The VM gets destoryed

Actual Behavior

No action is performed on the VM and the state is cleared of any info about it so no other commands can be executed.

Specifications

  • Version: Terraform version: 0.11.8 7a5c1d221ac209bbac66947c369815cd9ca70ed5
  • Plugin version: commit b35fc62
  • OS: Ubuntu 16.04
@Prativa20
Copy link
Contributor

@VincenzoDo Can you please check and confirm that this is not the case as mentioned in the log?

  • vra7_resource.example_machine1: possibly resource got deleted outside terraform

@VincenzoDo
Copy link
Author

Sure, I can confirm the VM exists and was not deleted previously.

@Prativa20
Copy link
Contributor

Prativa20 commented Oct 19, 2018

@VincenzoDo Can you also verify if Destroy Deployment action is enabled for in entitlement? I could reproduce this when my Destroy Deployment action is not added in entitlement.

@VincenzoDo
Copy link
Author

@Prativa20 The destroy deployment action is enabled, I can destroy the deployment from the UI.

@Prativa20
Copy link
Contributor

@VincenzoDo I could not reproduce it and the console logs here are also not very useful. I will create a PR with some more debug logs. And you can with the latest code.

@VincenzoDo
Copy link
Author

@Prativa20 Ok, I will wait for the PR

raghavav pushed a commit that referenced this issue Oct 30, 2018
Added debug logs needed for issue #93.

Signed-off-by: Prativa Bawri <[email protected]>
@Prativa20
Copy link
Contributor

@VincenzoDo Can you try with the latest code? I have added debug logs as part of #100
Please attach the vra-terraform.log file.
Thanks!

@VincenzoDo
Copy link
Author

@Prativa20 destroy action still fails, here you can find the log for the destroy part:
tflog_destroy.txt

@Prativa20
Copy link
Contributor

@VincenzoDo The log says that the destroy action template required for deleting the resource is not available. And that is the reason destroy is failing. I could reproduce this only when Destroy Machine action is not enabled in the entitlement. But as you mentioned, that it is not the case with your setup. I will open a PR to check in the first place if a destroy is allowed on the resource. If yes, will fetch the template. Will update the issue when the code is merged.

Thanks,
Prativa

@Prativa20
Copy link
Contributor

@VincenzoDo I have created a PR for this which is in review #103

@VincenzoDo
Copy link
Author

@Prativa20 I've tested the PR, and get the following when I try to destroy: "* vra7_resource.example_machine1: The deployment base-16198567 cannot be destroyed, your entitlement has no Destroy Deployment action enabled" but as you can see from this screenshot I have the destroy deployment action enabled:
image

@Prativa20
Copy link
Contributor

@VincenzoDo I couldn't reproduce this in my environment. We can have a call to see what is going on.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants