One provider, many AWX versions
AWX changes its API between releases, so the provider has to know which release it was generated from.
Once the provider is generated from the API description, a question shows up that you can ignore while everything is hand written: which AWX are we generating against?
AWX adds fields between releases, renames a few, and occasionally removes one, so a provider built against 23.9.0 and pointed at 24.2.0 will mostly work, and the interesting word in that sentence is mostly.
So instead of picking one version and telling everybody else to upgrade, the provider carries several.
Each one lives in its own package, generated from its own copy of the API description.
resources/api/23.9.0/resources/api/24.0.0/resources/api/24.1.0/resources/api/24.2.0/That renaming from a year earlier, the one that looked strange at the time, is what made this possible, because the package already knew which version it had come from.
The awkward part is the provider version number, because terraform gives us one number and we need it to say two things: which AWX this was generated from, and which build of the provider it is.
What we ended up with folds the build counter into the patch component.
AWX 24.6.1, build 3 -> v24.6.103AWX 24.6.1, build 4 -> v24.6.104AWX 24.6.2, build 0 -> v24.6.200You read it back with patch / 100 for the AWX patch and patch % 100 for the build, which is not beautiful.
It does mean somebody looking at v24.6.104 in a lock file can tell what it was built against without opening anything.
It does mean the provider version numbers jumped from 0.x straight to 24.x, which surprises people the first time they see it, and that’s the trade we made.
While we were in there anyway, token authentication went in next to basic auth, because sending an admin password to every API call was never a good idea and I had been meaning to fix it.
provider "awx" { hostname = "https://awx.example.com" token = var.awx_token}The old 21.8.0 support came out at the same time, and the generic properties moved to the root config instead of being repeated in every version.
That is the sort of cleanup you can only do once you can see all the versions side by side.