Open SimonKni opened 1 year ago
Dear all, I'd like this to be fixed asap! This is a HUGE issue...
What about doing a query like this: deployment/api/deployments/{id}/userEvents?size=100&sort=status,DESC&sort=createdAt,DESC&$top=1
As it's impossible to use $filter here, sorting by status alphabetical order returns SUCCESSFUL first, then additional sort with createdAt permits to get the last successful request, and with the top=1 we just look for one result and it's quicker.
The problem we may have: I don't see any method on vra-sdk-go to perform a request against deployment userEvents...
BTW, any news related this ? Thanks for your help.
Code of Conduct
This project has a Code of Conduct that all participants are expected to understand and follow:
vRA Version
Terraform Version
vRA Terraform Provider Version
Affected Resource(s)
Description
At the moment the vra provider catches the deployment last request and not the last successful request to compare the state via provided inputs. Applying the same plan again wouldn't be successfull as current terraform plan and checked inputs on the deployment are matching.
A solution would be to change the hardcoded API from querying inputs on deployments from the current call - which is returning the updated inputs whether the update was successful or not - to getting deployment events API, look up the last successful request, and take {input} there.
so for example switch from "GET /deployment/api/deployments/{id}?apiVersion=2020-08-25&expand=resources&expand=lastRequest" to "GET /deployment/api/deployments/{id}/userEvents?size=100&apiVersion=2020-08-25" and fetch last successful request inputs.
Terraform Configuration Files
config for creating the deployment
config for updating the deployment (invalid value to get a failed update)
Expected Behavior
After a failed update the
terraform plan
command should show a "Plan: 0 to add, 1 to change, 0 to destroy." againActual Behavior
After a failed update the
terraform plan
command shows a "No changes. Your infrastructure matches the configuration."Steps to Reproduce
terraform plan -out "vra.plan"
andterraform apply "vra.plan"
terraform plan -out "vra.plan"
andterraform apply "vra.plan"
)Screenshots
N/A
Debug Output
2023-09-01T10:58:15.694+0200 [INFO] provider.terraform-provider-vra_v0.7.3: 2023/09/01 10:58:15 GET /deployment/api/deployments/19314130-ee64-4973-9beb-4a82374267e4?apiVersion=2020-08-25&expand=resources&expand=lastRequest HTTP/1.1: timestamp=2023-09-01T10:58:15.692+0200
Panic Output
N/A
Important Factoids
N/A
References
Reference for the VMware Support: SR23443396206
Community Note