I got to test the new functionality to manage the statuses via Terraform using an independent resource.
It looks promising, but noticed a few issues that make it still unworkable, allow me to elaborate:
Categories are incorrect
The validation on the category only allows the values Open, Waiting, Closed and Unknown.
These categories are either wrong or incomplete, as InProgress is not allowed and impossible to define any status in this category...
Unknown does not show up anywhere either.
Default statuses are unmanageable (and blocking even)
By default, when creating a Worktype, it creates the statuses Open en Closed. There is no way to remove these using Terraform as the ID's are unknown to the tfstate.
Also, because these 2 statuses now exist, it is impossible to define the Open/Closed state in terraform, as they will return an error when creating them (status of the same name already exists)
So, I'm not able to remove them, not able to define them or edit them using Terraform, it requires an manual action in the UI to unblock.
Circular dependencies
When you define a status A, that allows an transition to status B and you define a status B that allows to transition to A, it is impossible to define this in Terraform due to a circular dependency.
Even though it is absolutely fine to do define this in the UI...
Regarding the InProgress status category, that seems to be fixed in version 1.55.0
The new allowed values are Open, Waiting, InProgress, Closed and Unknown.
Just want to decouple all the issues mentioned in the thread and give my two cents.
InProgress is not allowed --> This is resolved and it can be added a valid status
Tackle Circular dependencies.
Essentially this is a terraform limitation where we cannot create two dependent resources at the same time. But we can update these once created. destination_status_ids is an optional attribute. Believe this need to be done in a two step process.
1st step : create the resources without destination_status_ids
Unknown Status : We are in touch with the API team , why an unknown status is not being shown in the UI. Will get back to you as soon as I get info on it.
Open/Closed statuses auto creation: Its default API behaviour , where worktype statuses Open and Closed are created when a worktype is created. (Will get more info on the reasoning from API team)
One solution for this is to incorporate the tfstate .
Export all the resources back in a different directory with include_state_file = true. This way you can export the
resources created and tfstate can be managed from this point. Sample export definition provided below.
What you mentioned are workarounds that become really cumbersome with larger terraform repositories, we manage about 700+ resources (acceptance only) and having these run multiple times (and tinker with statefile / exports) to get in the required state is not how terraform should work. Also making automated deployments impossible because it requires so much manual actions.
Possible solution for the 2 remaining problems could be the following;
New/Closes automatically created
This can be solved if the API has an option to skip the auto-creation and is on by default in the terraform module.
Circular dependencies
This can be solved by not declaring these destinations within the status resource, but have seperate resources to link them together.
Would these options be viable to implement? Anything is better than these workarounds...