This guide is intended to help with the upgrading process and focuses only on the changes necessary to upgrade to version 0.7.0
of Confluent Provider from version 0.5.0
of Confluent Cloud Provider.
Before upgrading to version 0.7.0
, ensure that your environment
successfully runs terraform plan
without unexpected changes. Run the following command:
terraform plan
Your output should resemble:
confluentcloud_service_account.test-sa: Refreshing state... [id=sa-xyz123]
confluentcloud_environment.test-env: Refreshing state... [id=env-dge456]
confluentcloud_kafka_cluster.test-basic-cluster: Refreshing state... [id=lkc-abc123]
confluentcloud_kafka_acl.describe-test-basic-cluster: Refreshing state... [id=lkc-abc123/CLUSTER#kafka-cluster#LITERAL#User:12345#*#DESCRIBE#ALLOW]
confluentcloud_kafka_topic.orders: Refreshing state... [id=lkc-abc123/orders]
confluentcloud_kafka_acl.describe-orders: Refreshing state... [id=lkc-n2kvd/TOPIC#orders#LITERAL#User:12345#*#DESCRIBE#ALLOW]
...
No changes. Infrastructure is up-to-date.
The next step is to replace Confluent Cloud Provider (confluentinc/confluentcloud
) with Confluent Provider (confluentinc/confluent
) and to set the latest 0.7.0
version in a required_providers
block of your Terraform configuration.
terraform {
required_providers {
# ...
confluentcloud = {
source = "confluentinc/confluentcloud"
version = "0.5.0"
}
}
}
provider "confluentcloud" {
terraform {
required_providers {
# ...
confluent = {
source = "confluentinc/confluent"
version = "0.7.0"
}
}
}
provider "confluent" {
confluentcloud_kafka_acl
resourcehost
attribute is now required. Update your configuration to set it to "*"
.
resource "confluentcloud_kafka_acl" "describe-orders" {
# ...
}
resource "confluentcloud_kafka_acl" "describe-orders" {
# ...
host = "*"
}
kafka_cluster
attribute type was changed from _string_ to a _configuration block_. Update your configuration accordingly.
resource "confluentcloud_kafka_acl" "describe-orders" {
kafka_cluster = "lkc-abc123"
}
resource "confluentcloud_kafka_acl" "describe-orders" {
kafka_cluster {
id = "lkc-abc123"
}
}
confluentcloud_kafka_topic
resourcekafka_cluster
attribute type was changed from _string_ to a _configuration block_. Update your configuration accordingly.
resource "confluentcloud_kafka_topic" "orders" {
kafka_cluster = "lkc-abc123"
}
resource "confluentcloud_kafka_topic" "orders" {
kafka_cluster {
id = "lkc-abc123"
}
}
All resources and data sources have been renamed in the new Confluent Terraform Provider. The prefix has changed from confluentcloud
to confluent
. For example, confluentcloud_environment
resource was updated to confluent_environment
. Therefore, run the following commands to update your TF configuration file, for example, called main.tf
.
# In-place rename resources confluentcloud_environment -> confluent_environment etc in main.tf
sed -i '' 's/confluentcloud_environment/confluent_environment/' main.tf
sed -i '' 's/confluentcloud_kafka_acl/confluent_kafka_acl/' main.tf
sed -i '' 's/confluentcloud_kafka_cluster/confluent_kafka_cluster/' main.tf
sed -i '' 's/confluentcloud_kafka_topic/confluent_kafka_topic/' main.tf
sed -i '' 's/confluentcloud_role_binding/confluent_role_binding/' main.tf
sed -i '' 's/confluentcloud_service_account/confluent_service_account/' main.tf
Check that the replacement was successful by running the following command:
grep "confluentcloud" main.tf
The command should output 0 matches.
Similarly, you need to rename all resources and data sources in your TF state file, for example, called terraform.tfstate
. You can do it by running the following commands:
# Alternatively you could run
# terraform state replace-provider "registry.terraform.io/confluentinc/confluentcloud" "registry.terraform.io/confluentinc/confluent"
# Replaces confluentinc/confluentcloud with confluentinc/confluent TF Provider in terraform.tfstate
terraform state replace-provider confluentinc/confluentcloud confluentinc/confluent
# In-place rename resources confluentcloud_environment -> confluent_environment etc in confluent.state
sed -i '' 's/confluentcloud_environment/confluent_environment/' terraform.tfstate
sed -i '' 's/confluentcloud_kafka_acl/confluent_kafka_acl/' terraform.tfstate
sed -i '' 's/confluentcloud_kafka_cluster/confluent_kafka_cluster/' terraform.tfstate
sed -i '' 's/confluentcloud_kafka_topic/confluent_kafka_topic/' terraform.tfstate
sed -i '' 's/confluentcloud_role_binding/confluent_role_binding/' terraform.tfstate
sed -i '' 's/confluentcloud_service_account/confluent_service_account/' terraform.tfstate
# Find, download, and install new Confluent Provider (confluentinc/confluent) locally
terraform init
Check that the replacement was successful by running the following command:
grep "confluentcloud" terraform.tfstate
The command should output 0 matches.
Check that the upgrade was successful by ensuring that your environment
successfully runs terraform plan
without unexpected changes. Run the following command:
terraform plan
Your output should resemble:
confluent_service_account.test-sa: Refreshing state... [id=sa-xyz123]
confluent_environment.test-env: Refreshing state... [id=env-dge456]
confluent_kafka_cluster.test-basic-cluster: Refreshing state... [id=lkc-abc123]
confluent_kafka_acl.describe-test-basic-cluster: Refreshing state... [id=lkc-abc123/CLUSTER#kafka-cluster#LITERAL#User:sa-xyz123#*#DESCRIBE#ALLOW]
confluent_kafka_topic.orders: Refreshing state... [id=lkc-abc123/orders]
confluent_kafka_acl.describe-orders: Refreshing state... [id=lkc-abc123/TOPIC#orders#LITERAL#User:sa-xyz123#*#DESCRIBE#ALLOW]
...
No changes. Infrastructure is up-to-date.
If you run into any problems, please report an issue.