edgelesssys/constellation

Upgrading via terraform provider fails if microservice version was unset on installation

Closed this issue · 4 comments

Issue description

When installing constellation using the new terraform provider <2.15.0 it was possible to leave the constellation_microservice_version unset using a default value matching the provider version. This was changed in #2791. When attempting to upgrade to v2.15.0 the terraform provider will fail with the error message Parsing microservice version: invalid semver: v because it is trying to parse the null value from TF state auto-prefixed with v by the internal/semver.New.

Steps to reproduce the behavior

  1. Existing cluster with unset constellation_microservice_version in TF state.
  2. Upgrade to 2.15.0
  3. Will fail withParsing microservice version: invalid semver: v
  4. Manually insert the current microservice version into the TF state
  5. Upgrade will succeed

Version

v2.15.0

Constellation Config

No response

Hey @heilerich, thanks a lot for noticing and informing us about this!

While the change was marked as breaking in the changelog, we did not add the necessary migration steps. This has now been corrected. For future releases, migrations for breaking changes in the Terraform configuration will be automated.

Furthermore, we are introducing CI to check exactly these cases with the Terraform provider.

Let me know if I can assist with anything else.

Thanks for the quick reply. We already successfully upgraded our deployment, so this is not an issue for us anymore.

I think documenting this is in the changelog and possibly the upgrade docs is the right step, but I would like to point out that I think the current note in the changelog is still confusing :-) The phrase "in your Terraform configuration" seems to imply that you only have to update your declarations in your .tf files, which is what terraform will happily tell you itself. What took me a while to figure out is, that in order to fix the second, somewhat obscure error message you also have to edit your terraform state in addition to your configuration (an operation not officially supported by terraform and not straightforward when it lives in a remote backend and not in a local .tfstate file)

Hey @heilerich - thanks for reminding me!

I think I understood you correctly here. If you change the provider version to v.2.15.0 before having an up-to-date state, this error is expected. The note added in the release should also mention that you'll need to re-apply after updating the configuration value, but before upgrading to provider version v2.15.0. The value will then be populated into the state, so that the error can be prevented. I now changed the note to reflect this more clearly.

Thanks a lot for the heads-up here! 😃

Ah, I wish that I thought of that solution earlier today instead of messing with the state manually. Would have saved me some time and headaches :-) The new note seems clear enough to me.