@@ -25,57 +25,57 @@ resource "random_uuid" "identifier" {}
2525
2626# Create a new tenant
2727resource "astra_streaming_tenant" "streaming_tenant" {
28- tenant_name = substr("webstore-clicks-${random_uuid.identifier.id}", 0, 32)
29- 30- cloud_provider = "gcp"
31- deletion_protection = true
32- region = "us-central1"
28+ tenant_name = substr("webstore-clicks-${random_uuid.identifier.id}", 0, 32)
29+ 30+ cloud_provider = "gcp"
31+ deletion_protection = false
32+ region = "us-central1"
3333}
3434
3535# Create a new database
3636resource "astra_database" "db_database" {
37- name = substr("webstore-clicks-${random_uuid.identifier.id}", 0, 50)
38- keyspace = "click_data" # 48 characters max
39- cloud_provider = "gcp" # this must match the cloud_provider of the tenant
40- regions = ["us-central1"] # this must match the region of the tenant
41- deletion_protection = false
37+ name = substr("webstore-clicks-${random_uuid.identifier.id}", 0, 50)
38+ keyspace = "click_data" # 48 characters max
39+ cloud_provider = "gcp" # this must match the cloud_provider of the tenant
40+ regions = ["us-central1"] # this must match the region of the tenant
41+ deletion_protection = false
4242}
4343
4444# Create a new table in that database
4545resource "astra_table" "db_table" {
46- keyspace = astra_database.db_database.keyspace
47- database_id = astra_database.db_database.id
48- region = astra_database.db_database.regions[0]
49- table = "all_product_clicks"
50- clustering_columns = "visitor_id:click_timestamp"
51- partition_keys = "visitor_id:click_url"
52- column_definitions = [
53- {
54- Name: "click_timestamp"
55- Static: false
56- TypeDefinition: "bigint"
57- },
58- {
59- Name: "visitor_id"
60- Static: false
61- TypeDefinition: "uuid"
62- },
63- {
64- Name: "click_url"
65- Static: false
66- TypeDefinition: "text"
67- }
68- ]
46+ keyspace = astra_database.db_database.keyspace
47+ database_id = astra_database.db_database.id
48+ region = astra_database.db_database.regions[0]
49+ table = "all_product_clicks"
50+ clustering_columns = "visitor_id:click_timestamp"
51+ partition_keys = "visitor_id:click_url"
52+ column_definitions = [
53+ {
54+ Name : "click_timestamp"
55+ Static : false
56+ TypeDefinition : "bigint"
57+ },
58+ {
59+ Name : "visitor_id"
60+ Static : false
61+ TypeDefinition : "uuid"
62+ },
63+ {
64+ Name : "click_url"
65+ Static : false
66+ TypeDefinition : "text"
67+ }
68+ ]
6969}
7070
7171# Create a new CDC connection between tenant topic and db table
7272resource "astra_cdc" "db_cdc" {
73- database_id = astra_database.db_database.id
74- database_name = astra_database.db_database.name
75- table = astra_table.db_table.table
76- keyspace = astra_database.db_database.keyspace
77- tenant_name = astra_streaming_tenant.streaming_tenant.tenant_name
78- topic_partitions = 3
73+ database_id = astra_database.db_database.id
74+ database_name = astra_database.db_database.name
75+ table = astra_table.db_table.table
76+ keyspace = astra_database.db_database.keyspace
77+ tenant_name = astra_streaming_tenant.streaming_tenant.tenant_name
78+ topic_partitions = 3
7979}
8080
8181# --Formatted Outputs--
0 commit comments