The terraform state replace-provider
command is intended for switching between providers that are in some way equivalent to one another, such as the hashicorp/google
and hashicorp/google-beta
providers, or when someone forks a provider into their own namespace but remains compatible with the original provider.
Mongey/kafka
and confluentinc/confluent
do both have resource types that seem to represent the same concepts in the remote system:
Mongey/kafka |
confluentinc/confluent |
kafka_acl |
confluent_kafka_acl |
kafka_quota |
confluent_kafka_client_quota |
kafka_topic |
confluent_kafka_topic |
However, despite representing the same concepts in the remote system these resource types have different names and incompatible schemas, so there is no way to migrate directly between them. Terraform has no way to understand which resource types in one provider match with resource types in another, or to understand how to map attributes from one of the resource types onto corresponding attributes of the other.
Instead, I think the best thing to do here would be to ask Terraform to "forget" the objects and then re-import them into the new resource types:
terraform state rm kafka_acl.example
to ask Terraform to forget about the remote object associated with kafka_acl.example
. There is no undo for this action.
terraform import confluent_kafka_acl.example OBJECT-ID
to bind the OBJECT-ID
(as described in the documentation) to confluent_kafka_acl.example
.
I suggest practicing this in a non-production environment first so that you can be confident about the behavior of each of these commands, and learn how to translate from whatever ID format the Mongey/kafka
provider uses into whatever import ID format the confluentinc/confluent
provider uses to describe the same objects.