aztfmod/terraform-provider-azurecaf

2.0.0-preview-3 not working anymore

Pasukaru opened this issue · 9 comments

Hello,
we can't use the 2.0.0 version anymore since today. We are now getting this error during terraform init:

│ Error: Failed to install provider

│ Error while installing aztfmod/azurecaf v2.0.0-preview-3: could not query provider registry for registry.terraform.io/aztfmod/azurecaf: failed to retrieve authentication checksums for provider: 404 Not Found returned from github.com

This is using

    azurecaf = {
      source  = "aztfmod/azurecaf"
      version = "2.0.0-preview-3"
    }

How can we get v2 working again?

I saw 1.2.22 was released 9 days ago. Is it safe to use that version instead on already existing infrastructure?

Update:
Trying to go with 1.2.22 results in the following error:

│ The current state of azurecaf_name.terraform_resources was created by a newer provider version than is currently selected. Upgrade the azurecaf provider to work with this state.

What is the plan for existing infrastructure using 2.0.0-preview-3 going forward?

Update 2:
I found a workaround to switch from 2.0.0-preview-3 to 1.2.22. It is very ugly and dangerous, as the terraform state has to be manipulated manually.

First, change the azurecaf version in required_providers to 1.2.22 and remove azurecaf from .terraform.lock.hcl.
Then delete the .terraform directory and run terraform init to install 1.2.22.
Then pull the remote state:

terraform state pull > tfstate.json
cp tfstate.json tfstate.original.json # make a backup of the original

Then search for aztfmod and for any section you find that looks like the following:

"provider": "provider[\"registry.terraform.io/aztfmod/azurecaf\"]",
      "instances": [
        {
          "schema_version": 4,
          "attributes": {
          ...
          "random_string": ...

replace schema version from 4 to 3.
Also increment the serial at the top by one.

Additionally, I had to remove the random_string property from the attributes object as well. Otherwise I get a Error decoding "module..." from previous state: unsupported attribute "random_string"

Make sure to not modify anything else, or you could mess up your entire tfstate.

Then push the modified state:
terraform state push tfstate.json

After this, terraform plan should show no changes.

In case you messed up, you can reset the original state with terraform state push --force tfstate.original.json. Again, a very dangerous command to run...

I can't guarantee this works for everyone, but for our case it looks fine (for now).

We tried to up-/downgrade to 1.2.23 today but after successful terraform init -upgrade, we saw errors at terraform plan because resources in the state were created with a "newer" provider version. And even with the described workaround, we ended up with resources having to be recreated because their names would only be known after apply -- which is not an option in our system.

After some discussion of this issue in our team, we essentially concluded that we will discard the provider, unfortunately.

We will replace all generated names with manually maintained names, although this will be quite a lot of work but what was going on with the versioning of azurecaf is confusing or scaring us: There were new releases for the 1.2x version recently (today and a few days ago) but the 2.0.0 preview wasn't updated for months and even completely disappeared now, without even leaving a branch or anything. So it doesn't appear to be reliable enough to be used in production. 😞

Unfortunately, the Terraform registry still lists the 2.0.0-preview-3 as the latest version due to the highest version number rather than the most recent release.

So, sorry for actually not providing any help on how to really resolve the issue. I just wanted to share our thoughts and considerations on how to proceed with this.

Hi - is there a plan to fix this? It's wrecking an enterprise deployment we have for customers.

Note: When we try to 'upgrade' to the newest version of the naming provider, the provider is seen as an older version:

│ Error: Resource instance managed by newer provider version
│ 
│ The current state of azurecaf_name.hk_caf_level0_hub00_kvrsg was created by a newer provider version than is currently selected. Upgrade the azurecaf provider to work with this state.
╵
╷
│ Error: Resource instance managed by newer provider version
│ 
│ The current state of azurecaf_name.hk_caf_level0_hub00_kv00 was created by a newer provider version than is currently selected. Upgrade the azurecaf provider to work with this state.

In this case it's unclear how to "upgrade" ...

hi @Pasukaru, @andreassiegel, @archmangler - sorry we were not aware of preview being used into production.
We have re-released a v.2.0.0-preview3 to unstuck you.
Please let me know if it works for you.

Thank you @arnaudlh!

I think the main issue is that the Terraform Registry considers mainly the version number and displays the preview versions as the latest version, no matter how old they are:

image

So, everyone who doesn't take a closer look might use an old preview version with a high version number rather than a more recent release with a lower version number. This is how we ended up using the preview, and back then thought that there might be a stable release in one or two months.

Because of the issue @archmangler also pointed out, I'm not sure if we would ever be able to "downgrade" to the actual release version.

Quick update: Since the re-release of the preview version saves us a lot of work, we will continue to use it (in production 😄). Thanks a lot again for your quick reply and reaction to unblock us! 🥳

Would it be possible to provide a stable 2.0.0 version that can be used reliably? I'm not sure what the preview is about or what the differences between 1.2.x and v2 preview versions are...

Or alternatively, do you see a chance to do sort of a versioning stunt to allow switching from 2.0.0-preview-3 to 1.2.x? With the current versions, this won't be possible since resources have been created with a newer provider version. However, at least in theory, it might be possible to publish the 1.2.x version as some version higher than 2.0.0-preview-3 (maybe 2.2.x).

I'm well aware this wouldn't be proper versioning but on the other hand, allowed everyone to move away from the preview that probably never was actually meant to be used in production environments.

The work on the preview version could potentially continue under the 2.0.0-preview-x versions with the stable release version still having a higher version number.

Thanks for the feebacks @andreassiegel! We will work with @Nepomuceno and @LaurentLesle to make sure 2.0.0 release combines both worlds as much as possible!

Closing as resolved, reopen if impacted!

@arnaudlh I see there was a new release of the v1 version but as far as the Terraform registry is concerned, 2.0.0-preview3 is still the "latest" version:

image

Thus, there is no way to get to the most recently updated version.

Is there any update on the attempt and effort to release a v2 version that combines v2 preview and v1 releases, as indicated in December last year?

Hi @arnaudlh - Looks like we're seeing this again:

╷
│ Error: Failed to install provider
│ 
│ Error while installing aztfmod/azurecaf v2.0.0-preview3: could not query
│ provider registry for registry.terraform.io/aztfmod/azurecaf: failed to
│ retrieve authentication checksums for provider: the request failed after 2
│ attempts, please try again later: 503 Service Unavailable returned from
│ objects.githubusercontent.com