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:
Require that the configured version value is major.minor.path
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)
Strongly suggest that end-users use lifecycle { ignore_changes = [redpanda_version] } so that when the cluster is eventually updated, Terraform doesn't freak out
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 likemajor.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:major.minor.path
/v1beta2/redpanda_versions
endpoint to validate the configured version, then truncate the version and pass onlymajor.minor
to CreateCluster (or, fix the Cloud API to allow amajor.minor.patch
request)lifecycle { ignore_changes = [redpanda_version] }
so that when the cluster is eventually updated, Terraform doesn't freak out