confluentinc / terraform-provider-confluent

Terraform Provider for Confluent
Apache License 2.0
27 stars 63 forks source link

managing local confluent cluster #357

Closed ekozynin closed 7 months ago

ekozynin commented 7 months ago

I have local dev machine confluent cluster running

curl -O https://raw.githubusercontent.com/confluentinc/cp-all-in-one/7.5.0-post/cp-all-in-one-kraft/docker-compose.yml
podman-compose up -d

I have setup provider

provider "confluent" {
  kafka_id            = "EkWLeDPzTP2H5Md-tG83_A" # var.kafka_id                   # optionally use KAFKA_ID env var
  kafka_rest_endpoint = "http://localhost:8082" # var.kafka_rest_endpoint        # optionally use KAFKA_REST_ENDPOINT env var
  kafka_api_key       = "LOCAL" # var.kafka_api_key              # optionally use KAFKA_API_KEY env var
  kafka_api_secret    = "LOCAL" # var.kafka_api_secret           # optionally use KAFKA_API_SECRET env var
}

Trying to create a topic, givbes me Error: error creating Kafka Topic: 404 Not Found

resource "confluent_kafka_topic" "orders" {
  topic_name         = "test-topic"
  partitions_count = 1
}

I think it is because in local the endpoint for http-server is different https://docs.confluent.io/platform/current/kafka-rest/api.html#cluster-v3

When using the API in Confluent Server, all paths should be prefixed with /kafka as opposed to Standalone REST Proxy. For example, the path to list clusters is:

    Confluent Server: /kafka/v3/clusters
    Standalone REST Proxy: /v3/clusters

Did anyone have any success using confluent provider with locally installed cluster, and how can it be achieved?

linouk23 commented 7 months ago

👋 @ekozynin thanks for creating this issue!

Did anyone have any success using confluent provider with locally installed cluster

Currently TF Provider for Confluent only supports Confluent Cloud. Feel free to subscribe to https://github.com/confluentinc/terraform-provider-confluent/issues/145 to track the progress of CP support.