Skip to content

Commit

Permalink
docs: fix examples (#1594)
Browse files Browse the repository at this point in the history
  • Loading branch information
staceysalamon-aiven authored Feb 15, 2024
1 parent b22979d commit 1f88422
Show file tree
Hide file tree
Showing 63 changed files with 112 additions and 111 deletions.
3 changes: 2 additions & 1 deletion examples/aws_privatelink/provider.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terraform {
required_version = ">=0.13"
required_providers {
aiven = {
source = "aiven/aiven"
Expand All @@ -7,7 +8,7 @@ terraform {
}
}

# Initialize provider. No other config options than api_token
# Initialize provider
provider "aiven" {
api_token = var.aiven_api_token
}
Expand Down
10 changes: 3 additions & 7 deletions examples/aws_privatelink/services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ resource "aiven_kafka" "kafka-service" {
service_name = "privatelink-kafka1"
maintenance_window_dow = "monday"
maintenance_window_time = "10:00:00"
project_vpc_id = "YOUR-AWS-PROJECT-VPC-ID"
project_vpc_id = "AWS_PROJECT_VPC_ID"

kafka_user_config {
privatelink_access {
Expand All @@ -32,16 +32,12 @@ resource "aiven_aws_privatelink" "aws_pl" {
]
}

data "aiven_aws_privatelink" "pl" {
project = aiven_aws_privatelink.aws_pl.project
service_name = aiven_aws_privatelink.aws_pl.service_name
}

output "aws_privatelink" {
value = aiven_aws_privatelink.aws_pl
}

// After connecting to a VPC Endpoint from your an AWS account new service component is available
# After connecting to a VPC endpoint from your AWS account
# a new service component is available
data "aiven_service_component" "kafka_privatelink" {
project = aiven_aws_privatelink.aws_pl.project
service_name = aiven_aws_privatelink.aws_pl.service_name
Expand Down
3 changes: 1 addition & 2 deletions examples/cassandra_fork/project.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Project
resource "aiven_project" "project1" {
project = "project1"
card_id = var.aiven_card_id
project = "YOUR_ORG_NAME-project1"
}
3 changes: 2 additions & 1 deletion examples/cassandra_fork/provider.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terraform {
required_version = ">=0.13"
required_providers {
aiven = {
source = "aiven/aiven"
Expand All @@ -7,7 +8,7 @@ terraform {
}
}

# Initialize provider. No other config options than api_token
# Initialize provider
provider "aiven" {
api_token = var.aiven_api_token
}
3 changes: 1 addition & 2 deletions examples/cassandra_fork/variables.tf
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
variable "aiven_api_token" {}
variable "aiven_card_id" {}
variable "aiven_api_token" {}
7 changes: 3 additions & 4 deletions examples/clickhouse/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Initialize the provider
// The only configuration option needed is the API token

# Initialize the provider
terraform {
required_version = ">=0.13"
required_providers {
aiven = {
source = "aiven/aiven"
Expand All @@ -15,6 +14,6 @@ provider "aiven" {
}

variable "aiven_api_token" {
description = "Aiven console API token"
description = "Aiven API token"
type = string
}
20 changes: 10 additions & 10 deletions examples/clickhouse/services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "aiven_project" "clickhouse_dev" {
project = "clickhouse-dev"
}

// ClickHouse service in the same region
# ClickHouse service in the same region
resource "aiven_clickhouse" "dev" {
project = aiven_project.clickhouse_dev.project
cloud_name = "google-europe-west1"
Expand All @@ -12,28 +12,28 @@ resource "aiven_clickhouse" "dev" {
maintenance_window_time = "10:00:00"
}

// Sample ClickHouse database that can be used to write the raw data
# Sample ClickHouse database that can be used to write the raw data
resource "aiven_clickhouse_database" "iot_analytics" {
project = aiven_project.clickhouse_dev.project
service_name = aiven_clickhouse.dev.service_name
name = "iot_analytics"
}

// ETL user with write permissions to the IoT measurements DB
# ETL user with write permissions to the IoT measurements DB
resource "aiven_clickhouse_user" "etl" {
project = aiven_project.clickhouse_dev.project
service_name = aiven_clickhouse.dev.service_name
username = "etl"
}

// Writer role that will be granted insert privilege to the measurements DB
# Writer role that will be granted insert privilege to the measurements DB
resource "aiven_clickhouse_role" "writer" {
project = aiven_project.clickhouse_dev.project
service_name = aiven_clickhouse.dev.service_name
role = "writer"
}

// Writer role's privileges
# Writer role's privileges
resource "aiven_clickhouse_grant" "writer_role" {
project = aiven_clickhouse.dev.project
service_name = aiven_clickhouse.dev.service_name
Expand All @@ -52,7 +52,7 @@ resource "aiven_clickhouse_grant" "writer_role" {
}
}

// Grant the writer role to the ETL user
# Grant the writer role to the ETL user
resource "aiven_clickhouse_grant" "etl_user" {
project = aiven_clickhouse.dev.project
service_name = aiven_clickhouse.dev.service_name
Expand All @@ -63,21 +63,21 @@ resource "aiven_clickhouse_grant" "etl_user" {
}
}

// Analyst user with read-only access to the IoT measurements DB
# Analyst user with read-only access to the IoT measurements DB
resource "aiven_clickhouse_user" "analyst" {
project = aiven_project.clickhouse_dev.project
service_name = aiven_clickhouse.dev.service_name
username = "analyst"
}

// Reader role that will be granted insert privilege to the measurements DB
# Reader role that will be granted insert privilege to the measurements DB
resource "aiven_clickhouse_role" "reader" {
project = aiven_project.clickhouse_dev.project
service_name = aiven_clickhouse.dev.service_name
role = "reader"
}

// Reader role's privileges
# Reader role's privileges
resource "aiven_clickhouse_grant" "reader_role" {
project = aiven_clickhouse.dev.project
service_name = aiven_clickhouse.dev.service_name
Expand All @@ -90,7 +90,7 @@ resource "aiven_clickhouse_grant" "reader_role" {
}
}

// Grant the reader role to the Analyst user
# Grant the reader role to the Analyst user
resource "aiven_clickhouse_grant" "analyst_user" {
project = aiven_clickhouse.dev.project
service_name = aiven_clickhouse.dev.service_name
Expand Down
18 changes: 10 additions & 8 deletions examples/clickhouse_integrations/kafka_source/access.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// ETL user with write permissions to the IoT measurements DB
# Create an ETL user
resource "aiven_clickhouse_user" "etl" {
project = aiven_project.clickhouse_kafka_source.project
service_name = aiven_clickhouse.clickhouse.service_name
username = "etl"
}

// Writer role that will be granted insert privilege to the measurements DB
# Create a role named writer
resource "aiven_clickhouse_role" "writer" {
project = aiven_project.clickhouse_kafka_source.project
service_name = aiven_clickhouse.clickhouse.service_name
role = "writer"
}

// Writer role's privileges
# Set the privileges for the writer role
resource "aiven_clickhouse_grant" "writer_role" {
project = aiven_clickhouse.clickhouse.project
service_name = aiven_clickhouse.clickhouse.service_name
Expand All @@ -31,7 +31,8 @@ resource "aiven_clickhouse_grant" "writer_role" {
}
}

// Grant the writer role to the ETL user
# Grant the writer role to the ETL user
# to give them write permissions to the IoT measurements database
resource "aiven_clickhouse_grant" "etl_user" {
project = aiven_clickhouse.clickhouse.project
service_name = aiven_clickhouse.clickhouse.service_name
Expand All @@ -42,21 +43,21 @@ resource "aiven_clickhouse_grant" "etl_user" {
}
}

// Analyst user with read-only access to the IoT measurements DB
# Create an analyst
resource "aiven_clickhouse_user" "analyst" {
project = aiven_project.clickhouse_kafka_source.project
service_name = aiven_clickhouse.clickhouse.service_name
username = "analyst"
}

// Reader role that will be granted insert privilege to the measurements DB
# Create a role named reader role
resource "aiven_clickhouse_role" "reader" {
project = aiven_project.clickhouse_kafka_source.project
service_name = aiven_clickhouse.clickhouse.service_name
role = "reader"
}

// Reader role's privileges
# Set the privileges for the reader role
resource "aiven_clickhouse_grant" "reader_role" {
project = aiven_clickhouse.clickhouse.project
service_name = aiven_clickhouse.clickhouse.service_name
Expand All @@ -69,7 +70,8 @@ resource "aiven_clickhouse_grant" "reader_role" {
}
}

// Grant the reader role to the Analyst user
# Grant the reader role to the analyst user
# to give them insert privileges to the measurements database
resource "aiven_clickhouse_grant" "analyst_user" {
project = aiven_clickhouse.clickhouse.project
service_name = aiven_clickhouse.clickhouse.service_name
Expand Down
12 changes: 6 additions & 6 deletions examples/clickhouse_integrations/kafka_source/clickhouse.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ClickHouse service in the same region
# ClickHouse service in the same region
resource "aiven_clickhouse" "clickhouse" {
project = aiven_project.clickhouse_kafka_source.project
cloud_name = "google-europe-west1"
Expand All @@ -8,10 +8,10 @@ resource "aiven_clickhouse" "clickhouse" {
maintenance_window_time = "10:00:00"
}

// ClickHouse service integration with a Kafka source topic containing
// edge measurements in JSON format.
// This will create a `service_kafka-gcp-eu` database with a
// `edge_measurements_raw` using the Kafka ClickHouse Engine.
# ClickHouse service integration with a Kafka source topic containing
# edge measurements in JSON format.
# This will create a `service_kafka-gcp-eu` database with a
# `edge_measurements_raw` using the Kafka ClickHouse Engine.
resource "aiven_service_integration" "clickhouse_kafka_source" {
project = aiven_project.clickhouse_kafka_source.project
integration_type = "clickhouse_kafka"
Expand Down Expand Up @@ -45,7 +45,7 @@ resource "aiven_service_integration" "clickhouse_kafka_source" {
}
}

// ClickHouse database that can be used to run analytics over the ingested data
# ClickHouse database that can be used to run analytics over the ingested data
resource "aiven_clickhouse_database" "iot_analytics" {
project = aiven_project.clickhouse_kafka_source.project
service_name = aiven_clickhouse.clickhouse.service_name
Expand Down
10 changes: 5 additions & 5 deletions examples/clickhouse_integrations/kafka_source/kafka.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Kafka service on GCP eu-west
# Kafka service on GCP eu-west
resource "aiven_kafka" "kafka" {
project = aiven_project.clickhouse_kafka_source.project
cloud_name = "google-europe-west1"
Expand All @@ -7,7 +7,7 @@ resource "aiven_kafka" "kafka" {
maintenance_window_dow = "monday"
maintenance_window_time = "10:00:00"

// Enable kafka REST to view and send messages from the Console
# Enable kafka REST to view and send messages from the Console
kafka_user_config {
kafka_rest = true

Expand All @@ -17,7 +17,7 @@ resource "aiven_kafka" "kafka" {
}
}

// Kafka topic used to ingest edge measurements from the IoT devices fleet
# Kafka topic used to ingest edge measurements from the IoT devices fleet
resource "aiven_kafka_topic" "edge_measurements" {
project = aiven_project.clickhouse_kafka_source.project
service_name = aiven_kafka.kafka.service_name
Expand All @@ -29,7 +29,7 @@ resource "aiven_kafka_topic" "edge_measurements" {
config {
flush_ms = 10
cleanup_policy = "delete"
retention_bytes = "134217728" // 10 GiB
retention_ms = "604800000" // 1 week
retention_bytes = "134217728" # 10 GiB
retention_ms = "604800000" # 1 week
}
}
2 changes: 1 addition & 1 deletion examples/clickhouse_integrations/kafka_source/project.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Sample project name
# Project
resource "aiven_project" "clickhouse_kafka_source" {
project = "clickhouse-kafka-source"
}
4 changes: 2 additions & 2 deletions examples/clickhouse_integrations/kafka_source/provider.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Initialize the provider
// The only configuration option needed is the API token
# Initialize the provider

terraform {
required_version = ">=0.13"
required_providers {
aiven = {
source = "aiven/aiven"
Expand Down
2 changes: 1 addition & 1 deletion examples/clickhouse_integrations/kafka_source/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable "aiven_api_token" {
description = "Aiven console API token"
description = "Aiven API token"
type = string
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ClickHouse integration with a PostgreSQL source
===============================================

The goal of the example is to show how to exposed PostgreSQL databases in ClickHouse.
The goal of the example is to show how to expose PostgreSQL databases in ClickHouse.

Imagine you're tackling an inventory analytics use case and your PostgreSQL service has three databases you'd like to access in ClickHouse:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ClickHouse service based in the same region
# ClickHouse service based in the same region
resource "aiven_clickhouse" "clickhouse" {
project = aiven_project.clickhouse_postgres_source.project
service_name = "clickhouse-gcp-us"
Expand All @@ -9,8 +9,8 @@ resource "aiven_clickhouse" "clickhouse" {

}

// ClickHouse service integration for the PostgreSQL service as source
// exposing three databases in the public schema
# ClickHouse service integration for the PostgreSQL service as source
# exposing three databases in the public schema
resource "aiven_service_integration" "clickhouse_postgres_source" {
project = aiven_project.clickhouse_postgres_source.project
integration_type = "clickhouse_postgresql"
Expand Down
4 changes: 2 additions & 2 deletions examples/clickhouse_integrations/postgres_source/postgres.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Postgres service based in GCP US East
# Postgres service based in GCP US East
resource "aiven_pg" "postgres" {
project = aiven_project.clickhouse_postgres_source.project
service_name = "postgres-gcp-us"
cloud_name = "google-us-east4"
plan = "business-8" // Primary + read replica
plan = "business-8" # Primary and read replica
maintenance_window_dow = "monday"
maintenance_window_time = "10:00:00"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The only configuration option needed is the API token

terraform {
required_version = ">=0.13"
required_providers {
aiven = {
source = "aiven/aiven"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
variable "aiven_api_token" {
description = "Aiven console API token"
description = "Aiven API token"
type = string
}
3 changes: 2 additions & 1 deletion examples/datadog/provider.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
terraform {
required_version = ">=0.13"
required_providers {
aiven = {
source = "aiven/aiven"
Expand All @@ -7,7 +8,7 @@ terraform {
}
}

# Initialize provider. No other config options than api_token
# Initialize provider
provider "aiven" {
api_token = var.aiven_api_token
}
Loading

0 comments on commit 1f88422

Please sign in to comment.