redpanda-data / terraform-provider-redpanda

Apache License 2.0
6 stars 3 forks source link

`redpanda_version` interacts weirdly with Terraform data model #174

Open ligfx opened 1 month ago

ligfx commented 1 month ago

Problem

Currently, resource_cluster.redpanda_version is configurable and passed to CreateCluster, but the actual remote state is ignored. generateModel simply uses the configured value and ignores the value returned by the server.

This happens because (1) The Cloud API only allows requesting a version like major.minor (???), but then returns version values like major.minor.patch and (2) Cluster versions can and will be updated outside of Terraform (there's no way to do it inside Terraform since the API doesn't support it, and updates are automatically managed by Redpanda anyways).

This is weird and doesn't fit with the Terraform model!

Solutions

Should we just make redpanda_version non-configurable, and always return the server version? This is simplest.

Or, if we keep redpanda_version configurable and want to reconcile with server state, one possible path could be:

  1. Require that the configured version value is major.minor.path
  2. Hit the /v1beta2/redpanda_versions endpoint to validate the configured version, then truncate the version and pass only major.minor to CreateCluster (or, fix the Cloud API to allow a major.minor.patch request)
  3. Strongly suggest that end-users use lifecycle { ignore_changes = [redpanda_version] } so that when the cluster is eventually updated, Terraform doesn't freak out