cp terraform.sample.tfvars terraform.tfvarsterraform init
terraform apply4. Above command will fail while accessing the data plane for CC - like creating mirror topics, topics, acls, rbac, cluster links etc. For this, you required to setup a forward proxy with NGINX. Follow these steps: https://docs.confluent.io/cloud/current/networking/ccloud-console-access.html#configure-a-proxy. Add Both the clusters bootstrap endpoint url in /etc/hosts
nc -vz <CC_PRIMARY_BOOTSTRAP_URL> 9092
nc -vz <CC_SECONDARY_BOOTSTRAP_URL> 9092terraform apply curl -X GET https://{{src_cluster_bootstrap}}/kafka/v3/clusters/{{src_cluster_id}}/links \
-u {{src_cluster_api_key}}:{{src_cluster_api_secret}}
curl -X GET https://{{dest_cluster_bootstrap}}/kafka/v3/clusters/{{dest_cluster_id}}/links \
-u {{dest_cluster_api_key}}:{{dest_cluster_api_secret}}
curl -X GET https://{{src_cluster_bootstrap}}/kafka/v3/clusters/{{src_cluster_id}}/topics \
-u {{src_cluster_api_key}}:{{src_cluster_api_secret}}
curl -X GET https://{{dest_cluster_bootstrap}}/kafka/v3/clusters/{{dest_cluster_id}}/topics \
-u {{dest_cluster_api_key}}:{{dest_cluster_api_secret}}curl -X GET https://{{src_cluster_bootstrap}}/kafka/v3/clusters/{{src_cluster_id}}/links/{{src_cl_link_name}}/mirrors \
-u {{src_cluster_api_key}}:{{src_cluster_api_secret}}
curl -X GET https://{{dest_cluster_bootstrap}}/kafka/v3/clusters/{{dest_cluster_id}}/links/{{dest_cl_link_name}}/mirrors \
-u {{dest_cluster_api_key}}:{{dest_cluster_api_secret}}terraform destroy -target confluent_network.primay-network-transit-gatewaycurl -X POST https://{{dest_cluster_bootstrap}}/kafka/v3/clusters/{{dest_cluster_id}}/links/{{dest_cl_link_name}}/mirrors:reverse-and-start-mirror \
-u {{dest_cluster_api_key}}:{{dest_cluster_api_secret}} \
-H "Content-Type: application/json" \
-d '{
"mirror_topic_names": ["active-passive-a"]
}'# Source Cluster:
confluent kafka acl create --allow --service-account {{source_service_account}} --operations read,describe-configs --topic {{source_topic}} --cluster {{source_cluster_id}} --environment {{source_environment_id}}
confluent kafka acl create --allow --service-account {{source_service_account}} --operations describe,alter --cluster-scope --cluster {{source_cluster_id}} --environment {{source_environment_id}}
# Principal | Permission | Operation | Resource Type | Resource Name | Pattern Type
# -----------------------+------------+------------------+---------------+------------------+---------------
# User:{{source_service_account}} | ALLOW | ALTER | CLUSTER | kafka-cluster | LITERAL
# User:{{source_service_account}} | ALLOW | DESCRIBE | CLUSTER | kafka-cluster | LITERAL
# User:{{source_service_account}} | ALLOW | DESCRIBE_CONFIGS | TOPIC | {{source_topic}} | LITERAL
# User:{{source_service_account}} | ALLOW | READ | TOPIC | {{source_topic}} | LITERAL
# Destination Cluster:
confluent kafka acl create --allow --service-account {{destination_service_account}} --operations read,describe-configs --topic {{destination_topic}} --cluster {{destination_cluster_id}} --environment {{destination_environment_id}}
confluent kafka acl create --allow --service-account {{destination_service_account}} --operations describe,alter --cluster-scope --cluster {{destination_cluster_id}} --environment {{destination_environment_id}}
# Principal | Permission | Operation | Resource Type | Resource Name | Pattern Type
# -----------------------+------------+------------------+---------------+------------------+---------------
# User:{{destination_service_account}} | ALLOW | ALTER | CLUSTER | kafka-cluster | LITERAL
# User:{{destination_service_account}} | ALLOW | DESCRIBE | CLUSTER | kafka-cluster | LITERAL
# User:{{destination_service_account}} | ALLOW | DESCRIBE_CONFIGS | TOPIC | {{destination_topic}} | LITERAL
# User:{{destination_service_account}} | ALLOW | READ | TOPIC | {{destination_topic}} | LITERAL
9. If the command passes, move the producer and consumer to secondary & also check offset lag between the clusters
terraform apply -target confluent_network.primay-network-transit-gatewaycurl -X GET 'https://{{src_cluster_bootstrap}}/kafka/v3/clusters/{{src_cluster_id}}/links/{{src_cl_link_name}}/mirrors' --header 'Authorization: Basic {{auth_src_cl}}' --header 'Accept: */*'curl -X POST 'https://{{src_cluster_bootstrap}}/kafka/v3/clusters/{{src_cluster_id}}/links/{{src_cl_link_name}}/mirrors:reverse-and-start-mirror' --header 'Authorization: Basic {{auth_src_cl}}' --header 'Content-Type: application/json' --data '{
"mirror_topic_names": ["{{primary_mirror_topic}}"]
}'
terraform destroy






