Skip to content

bleporini/cc-gw-demo

Repository files navigation

Confluent Cloud Gateway Demo

This project demonstrates how to use a Confluent Cloud Gateway to provide network isolation and a custom domain name for a Confluent Cloud Kafka cluster.

The entire infrastructure on Confluent Cloud is provisioned automatically using Terraform, and the gateway is run locally using Docker Compose.

Prerequisites

Before you begin, ensure you have the following tools installed:

You will also need a Confluent Cloud account.

Configuration

The Terraform scripts require your Confluent Cloud API key and secret. You can provide these credentials using one of the following methods.

Method 1: Using a terraform.tfvars file (Recommended for local development)

Create a file named terraform.tfvars in the root of the project with the following content:

confluent_cloud_api_key    = "YOUR_CONFLUENT_CLOUD_API_KEY"
confluent_cloud_api_secret = "YOUR_CONFLUENT_CLOUD_API_SECRET"

Replace the placeholder values with your actual Confluent Cloud credentials. Terraform automatically loads variables from this file.

Method 2: Using Environment Variables (Recommended for CI/CD)

You can provide the Terraform input variables via environment variables by prefixing them with TF_VAR_.

In your terminal, export the following variables:

export TF_VAR_confluent_cloud_api_key="YOUR_CONFLUENT_CLOUD_API_KEY"
export TF_VAR_confluent_cloud_api_secret="YOUR_CONFLUENT_CLOUD_API_SECRET"

Replace the placeholder values with your actual credentials. Terraform will automatically use these environment variables to populate the confluent_cloud_api_key and confluent_cloud_api_secret input variables.

Usage

The project includes simple scripts to set up and tear down the entire demo environment.

Setup

To provision the Confluent Cloud resources and start the local gateway, run the setup script:

bash setup.sh

This script performs the following actions:

  1. Generates the necessary self-signed TLS certificates for the custom domain.
  2. Initializes Terraform (terraform init).
  3. Provisions the Confluent Cloud environment, Kafka cluster, service account, and API keys (terraform apply).
  4. Starts the Confluent Gateway service locally via docker compose up.

Teardown

To stop the gateway and destroy all cloud resources, run the teardown script:

bash teardown.sh

This script will:

  1. Stop and remove the local Docker containers and their volumes (docker compose down -v).
  2. Destroy all infrastructure previously created by Terraform (terraform destroy).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors