Skip to content

Commit

Permalink
Merge pull request #168 from volcengine/Feat/kafka
Browse files Browse the repository at this point in the history
Feat/kafka
  • Loading branch information
msq177 authored Jun 24, 2024
2 parents 7602b50 + 46fa6f6 commit db3014d
Show file tree
Hide file tree
Showing 63 changed files with 6,352 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/common_volcengine_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package common

const (
TerraformProviderName = "terraform-provider-volcengine"
TerraformProviderVersion = "0.0.146"
TerraformProviderVersion = "0.0.147"
)
1 change: 1 addition & 0 deletions docgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ var resourceKeys = map[string]string{
"cdn": "CDN",
"financial_relation": "FINANCIAL_RELATION",
"cloud_identity": "CLOUD_IDENTITY",
"kafka": "KAFKA",
}

type Products struct {
Expand Down
82 changes: 82 additions & 0 deletions example/dataKafkaConsumedPartitions/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
data "volcengine_zones" "foo" {
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_kafka_instance" "foo" {
instance_name = "acc-test-kafka"
instance_description = "tf-test"
version = "2.2.2"
compute_spec = "kafka.20xrate.hw"
subnet_id = volcengine_subnet.foo.id
user_name = "tf-user"
user_password = "tf-pass!@q1"
charge_type = "PostPaid"
storage_space = 300
partition_number = 350
project_name = "default"
tags {
key = "k1"
value = "v1"
}

parameters {
parameter_name = "MessageMaxByte"
parameter_value = "12"
}
parameters {
parameter_name = "LogRetentionHours"
parameter_value = "70"
}
}

resource "volcengine_kafka_group" "foo" {
instance_id = volcengine_kafka_instance.foo.id
group_id = "acc-test-group"
description = "tf-test"
}

resource "volcengine_kafka_sasl_user" "foo" {
user_name = "acc-test-user"
instance_id = volcengine_kafka_instance.foo.id
user_password = "suqsnis123!"
description = "tf-test"
all_authority = true
password_type = "Scram"
}

resource "volcengine_kafka_topic" "foo" {
topic_name = "acc-test-topic"
instance_id = volcengine_kafka_instance.foo.id
description = "tf-test"
partition_number = 15
replica_number = 3

parameters {
min_insync_replica_number = 2
message_max_byte = 10
log_retention_hours = 96
}

all_authority = false
access_policies {
user_name = volcengine_kafka_sasl_user.foo.user_name
access_policy = "Pub"
}
}

data "volcengine_kafka_consumed_partitions" "default" {
instance_id = volcengine_kafka_instance.foo.id
group_id = volcengine_kafka_group.foo.group_id
topic_name = volcengine_kafka_topic.foo.topic_name
}
82 changes: 82 additions & 0 deletions example/dataKafkaConsumedTopics/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
data "volcengine_zones" "foo" {
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_kafka_instance" "foo" {
instance_name = "acc-test-kafka"
instance_description = "tf-test"
version = "2.2.2"
compute_spec = "kafka.20xrate.hw"
subnet_id = volcengine_subnet.foo.id
user_name = "tf-user"
user_password = "tf-pass!@q1"
charge_type = "PostPaid"
storage_space = 300
partition_number = 350
project_name = "default"
tags {
key = "k1"
value = "v1"
}

parameters {
parameter_name = "MessageMaxByte"
parameter_value = "12"
}
parameters {
parameter_name = "LogRetentionHours"
parameter_value = "70"
}
}

resource "volcengine_kafka_group" "foo" {
instance_id = volcengine_kafka_instance.foo.id
group_id = "acc-test-group"
description = "tf-test"
}

resource "volcengine_kafka_sasl_user" "foo" {
user_name = "acc-test-user"
instance_id = volcengine_kafka_instance.foo.id
user_password = "suqsnis123!"
description = "tf-test"
all_authority = true
password_type = "Scram"
}

resource "volcengine_kafka_topic" "foo" {
topic_name = "acc-test-topic"
instance_id = volcengine_kafka_instance.foo.id
description = "tf-test"
partition_number = 15
replica_number = 3

parameters {
min_insync_replica_number = 2
message_max_byte = 10
log_retention_hours = 96
}

all_authority = false
access_policies {
user_name = volcengine_kafka_sasl_user.foo.user_name
access_policy = "Pub"
}
}

data "volcengine_kafka_consumed_topics" "default" {
instance_id = volcengine_kafka_instance.foo.id
group_id = volcengine_kafka_group.foo.group_id
topic_name = volcengine_kafka_topic.foo.topic_name
}
51 changes: 51 additions & 0 deletions example/dataKafkaGroups/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
data "volcengine_zones" "foo" {
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_kafka_instance" "foo" {
instance_name = "acc-test-kafka"
instance_description = "tf-test"
version = "2.2.2"
compute_spec = "kafka.20xrate.hw"
subnet_id = volcengine_subnet.foo.id
user_name = "tf-user"
user_password = "tf-pass!@q1"
charge_type = "PostPaid"
storage_space = 300
partition_number = 350
project_name = "default"
tags {
key = "k1"
value = "v1"
}

parameters {
parameter_name = "MessageMaxByte"
parameter_value = "12"
}
parameters {
parameter_name = "LogRetentionHours"
parameter_value = "70"
}
}

resource "volcengine_kafka_group" "foo" {
instance_id = volcengine_kafka_instance.foo.id
group_id = "acc-test-group"
description = "tf-test"
}

data "volcengine_kafka_groups" "default" {
instance_id = volcengine_kafka_group.foo.instance_id
}
45 changes: 45 additions & 0 deletions example/dataKafkaInstances/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
data "volcengine_zones" "foo" {
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_kafka_instance" "foo" {
instance_name = "acc-test-kafka"
instance_description = "tf-test"
version = "2.2.2"
compute_spec = "kafka.20xrate.hw"
subnet_id = volcengine_subnet.foo.id
user_name = "tf-user"
user_password = "tf-pass!@q1"
charge_type = "PostPaid"
storage_space = 300
partition_number = 350
project_name = "default"
tags {
key = "k1"
value = "v1"
}

parameters {
parameter_name = "MessageMaxByte"
parameter_value = "12"
}
parameters {
parameter_name = "LogRetentionHours"
parameter_value = "70"
}
}

data "volcengine_kafka_instances" "default" {
instance_id = volcengine_kafka_instance.foo.id
}
2 changes: 2 additions & 0 deletions example/dataKafkaRegions/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data "volcengine_kafka_regions" "default" {
}
55 changes: 55 additions & 0 deletions example/dataKafkaSaslUsers/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
data "volcengine_zones" "foo" {
}

resource "volcengine_vpc" "foo" {
vpc_name = "acc-test-vpc"
cidr_block = "172.16.0.0/16"
}

resource "volcengine_subnet" "foo" {
subnet_name = "acc-test-subnet"
cidr_block = "172.16.0.0/24"
zone_id = data.volcengine_zones.foo.zones[0].id
vpc_id = volcengine_vpc.foo.id
}

resource "volcengine_kafka_instance" "foo" {
instance_name = "acc-test-kafka"
instance_description = "tf-test"
version = "2.2.2"
compute_spec = "kafka.20xrate.hw"
subnet_id = volcengine_subnet.foo.id
user_name = "tf-user"
user_password = "tf-pass!@q1"
charge_type = "PostPaid"
storage_space = 300
partition_number = 350
project_name = "default"
tags {
key = "k1"
value = "v1"
}

parameters {
parameter_name = "MessageMaxByte"
parameter_value = "12"
}
parameters {
parameter_name = "LogRetentionHours"
parameter_value = "70"
}
}

resource "volcengine_kafka_sasl_user" "foo" {
user_name = "acc-test-user"
instance_id = volcengine_kafka_instance.foo.id
user_password = "suqsnis123!"
description = "tf-test"
all_authority = true
password_type = "Scram"
}

data "volcengine_kafka_sasl_users" "default" {
instance_id = volcengine_kafka_instance.foo.id
user_name = volcengine_kafka_sasl_user.foo.user_name
}
Loading

0 comments on commit db3014d

Please sign in to comment.