Skip to content

Commit

Permalink
feat: add resources for Kafka user, topic, and ACL
Browse files Browse the repository at this point in the history
  • Loading branch information
Gezi-lzq committed Aug 7, 2024
1 parent 8a50a3e commit f3b1001
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/resources/intergation/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
terraform {
required_providers {
automq = {
source = "hashicorp.com/edu/automq"
}
}
required_version = ">= 0.1"
}

provider "automq" {
byoc_host = "http://localhost:8081"
token = "123456"
}

resource "automq_intergation" "example" {
environment_id = "example123"
name = "example"
type = "Prometheus"
endpoint = "http://localhost:8081"
prometheus_config = {
"username" = "admin"
"password" = "admin"
}
}
24 changes: 24 additions & 0 deletions examples/resources/kafka_acl/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
terraform {
required_providers {
automq = {
source = "hashicorp.com/edu/automq"
}
}
required_version = ">= 0.1"
}

provider "automq" {
byoc_host = "http://localhost:8081"
token = "123456"
}

resource "automq_kafka_acl" "example" {
environment_id = "example123"
kafka_instance = "example"
resource_type = "TOPIC"
resource_name = "example-"
pattern_type = "PREFIXED"
principal = "automq_kafka_user"
operation_group = "ALL"
permission = "ALLOW"
}
17 changes: 17 additions & 0 deletions examples/resources/kafka_topic/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
terraform {
required_providers {
automq = {
source = "hashicorp.com/edu/automq"
}
}
required_version = ">= 0.1"
}

provider "automq" {
byoc_host = "http://localhost:8081"
token = "123456"
}

resource "automq_kafka_topic" "example" {

}
17 changes: 17 additions & 0 deletions examples/resources/kafka_user/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
terraform {
required_providers {
automq = {
source = "hashicorp.com/edu/automq"
}
}
required_version = ">= 0.1"
}

provider "automq" {
byoc_host = "http://localhost:8081"
token = "123456"
}

resource "automq_kafka_user" "example" {

}
4 changes: 4 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ func (p *AutoMQProvider) Configure(ctx context.Context, req provider.ConfigureRe
func (p *AutoMQProvider) Resources(ctx context.Context) []func() resource.Resource {
return []func() resource.Resource{
NewKafkaInstanceResource,
NewKafkaTopicResource,
NewKafkaUserResource,
NewKafkaAclResource,
NewIntegrationResource,
}
}

Expand Down

0 comments on commit f3b1001

Please sign in to comment.