Thanks to visit codestin.com
Credit goes to github.com

Skip to content

mcolomerc/confluent-cloud-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Confluent Cloud Sandbox

Managing Confluent Cloud using Terraform.

Prerequisites

Create a Confluent Cloud Cloud API Key

Create a service account called tf_runnerin Confluent Cloud

Assign the OrganizationAdmin role to the tf_runner service account

Create a Cloud API Key for the tf_runner service account

Environment Variables

Terraform will use the following environment variables to authenticate with Confluent Cloud.

export CONFLUENT_CLOUD_API_KEY="<CONFLUENT_CLOUD_API_KEY>"
export CONFLUENT_CLOUD_API_SECRET="<CONFLUENT_CLOUD_API_SECRET>"

Variables

  1. Provide a Confluent Cloud Environment ID.
  • environment: Confluent Cloud Environment ID
  1. Provide Cluster details
  • cluster: Cluster map.(Defaults)
    • display_name = "sandbox"
    • availability = "SINGLE_ZONE"
    • cloud = "GCP"
    • region = "europe-west1"
    • type = "BASIC"
  1. Provide a Service Account Name to create a ClusterAdmin role binding.
  • service_account: Service Account Name

Terraform

terraform init

Build the plan.

terraform plan --var-file=sandbox.tfvars

Apply - Using auto-approve skips interactive approval of plan before applying.

terraform apply -auto-approve --var-file=sandbox.tfvars
  1. Outputs
  • Cluster Bootstrap Server endpoint:
terraform show -json terraform.tfstate | jq '.values.outputs.cluster.value.bootstrap_endpoint'
  • Confluent Cloud Cluster API_KEY:
terraform show -json terraform.tfstate | jq '.values.outputs.cluster_api_key.value.id'
  • Confluent Cloud Cluster API_SECRET:
terraform show -json terraform.tfstate | jq '.values.outputs.cluster_api_key.value.secret'

Destroy

terraform destroy --var-file=sandbox.tfvars

or

terraform apply -auto-approve -destroy --var-file=sandbox.tfvars

Modules

Name Source Version
cluster github.com/mcolomerc/terraform-confluent-kafka-cluster v1.0.0
cluster_admin_service_account github.com/mcolomerc/terraform-confluent-iam v1.0.2

Inputs

Name Description Type Default Required
cluster Cluster map(any)
{
"availability": "SINGLE_ZONE",
"cloud": "GCP",
"display_name": "sandbox",
"region": "europe-west1",
"type": "BASIC"
}
no
confluent_cloud_api_key Confluent Cloud API Key string n/a yes
confluent_cloud_api_secret Confluent Cloud API Secret string n/a yes
environment Environment string n/a yes
service_account Service Account Name string n/a yes

Outputs

Name Description
cluster n/a
cluster_api_key n/a
cluster_id n/a

About

Confluent Cloud with Terraform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages