Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azapi can't remove vm with attached disks tags #594

Open
CodingGlad opened this issue Aug 28, 2024 · 2 comments
Open

azapi can't remove vm with attached disks tags #594

CodingGlad opened this issue Aug 28, 2024 · 2 comments

Comments

@CodingGlad
Copy link

I have got troubles with managing tags using azapi. After creating a new VM with an attached disk using terraform and azapi_resource I can't properly manage tags. Versions from 1.12.1 all the way up to 1.15.0 can add new tags to the vm, but can't properly remove them. I have experienced this with imported vms. I don't know whether this happens in other scenarios too.

1.12.1 after removing the tag from configuration main.tf file states after terraform plan that it is going to be removed. After approving and executing, .tfstate doesn't have this tag anymore, but in azure portal it is still present.

1.13.0 to 1.15.0 after removing the tag from configuration main.tf file states after terraform plan that it is going to be removed. After approving and executing, .tfstate still has this tag and it is still present in azure portal too. After running terraform plan again, it says that it wil be removed again, but again nothing cchanges after execution and so on and so on.

I can provide resource creation with proper explanation on what to do to experience this if this description didn't do the job properly.

@ms-henglu
Copy link
Member

Hi @CodingGlad ,

Thank you for taking time to report this issue!

I couldn't reproduce it locally. Would you please share the debug logs to help investigate? Thanks.

Here's how to get the debug logs:

  1. Add the following environment variables:
export TF_LOG=DEBUG; export TF_LOG_PATH=./terraform.log
  1. Run terraform commands, the logs will be stored in the terraform.log file.

@CodingGlad
Copy link
Author

I have managed to recreate the issue but with another problem I don't quite understand. I have done the same steps as last time but now every terraform apply command that was used to change tags couldn't finish on it's own. After I imported my VM, I have added a new tag in main.tf, applied the changes, the tag got added but the script itself didn't finish and I had to shut it down.

After that I tried to remove the tag. Terraform realised that the tag was added and tries to remove it. But again, the script doesn't finish. So it's a little bit different to the first occurence. I have tried it both in PowerShell and WSL with Ubuntu. I have attached logs from both environments.

If this won't help, I could provide better descriptions of the steps I took to create this issue.
terraform_win.log
terraform_wsl.log

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

No branches or pull requests

2 participants