vmware / terraform-provider-vra

Terraform Provider for VMware Aria Automation
https://registry.terraform.io/providers/vmware/vra/
Mozilla Public License 2.0
101 stars 89 forks source link

Updating `catalog_item_version` forces new rather than updating #509

Open dpower1985 opened 10 months ago

dpower1985 commented 10 months ago

Code of Conduct

This project has a Code of Conduct that all participants are expected to understand and follow:

vRA Version

8.11

Terraform Version

1.5.7

vRA Terraform Provider Version

0.8.3

Affected Resource(s)

Terraform Configuration Files

resource "vra_deployment" "dave_terraform_test" {
  name                 = "Test Deployment"
  description          = "terraform test deployment description"
  catalog_item_id      = data.vra_catalog_item.dave_terraform_test.id
  catalog_item_version = "26.1"
  project_id           = data.vra_project.dave_terraform_test.id
  }

Expected Behavior

Existing deployment will be updated to link with version 26.1 of the Cloud Template/Catalog Item

Actual Behavior

Plan reports that an update to the catalog_item_version will force a replacement of the deployment and that there is 1 to add, 0 to change, 1 to destroy

Steps to Reproduce

  1. Create deployment from catalog item using terraform apply
  2. Update Cloud Template and release new version to catalog
  3. Update main.tf with new catalog_item_version
  4. terraform apply / terraform plan

Screenshots

image image

Debug Output

N/A

Panic Output

N/A

Important Factoids

N/A

References

N/A

Community Note

an2ane commented 10 months ago

Specifying a version will automatically replace the current deployment. I've never seen otherwise. If you don't specify any version, it will stay on the same version (the last one available at that moment).

I tried through the UI, and I have the same behavior. It wants to re-create the machine. Pretty sure this is by design and how vRA handles versions.

martin9700 commented 10 months ago

Specifying a version will automatically replace the current deployment. I've never seen otherwise. If you don't specify any version, it will stay on the same version (the last one available at that moment).

I tried through the UI, and I have the same behavior. It wants to re-create the machine. Pretty sure this is by design and how vRA handles versions.

Just tested this and when catalog_item_version is removed it still triggers a destroy and rebuild.

an2ane commented 10 months ago

Yes, this is how it is done by design. You cannot upgrade to a newer version on AA8.x. If you want to do so, you have to rebuild entirely your deployment.

You can check this easily on AA, by going on our Cloud Template in the "Design" tab, click "Deploy", on the dropdown, select "Update deployment", select the deployment you want to update on the latest version of your CT, and see that it will rebuild your deployment.

martin9700 commented 10 months ago

I don't know about the OP but for me I have several hundred servers all deployed using data "vra_blueprint" instead of "vra_catalog_item". Unfortunately blueprint deployments are now broken with the latest version of VRA (see here: https://github.com/vmware/terraform-provider-vra/issues/505) and switching over to use catalog_item would be a potential fix except that it will destroy the server and rebuild it. This is slightly less then ideal (a little smidge of sarcasm).

I do appreciate the additional information though, thank you.