Skip to content

Commit

Permalink
feat: add new resources for Kafka user, topic, and ACL (#7)
Browse files Browse the repository at this point in the history
* feat: add new resources for Kafka user, topic, and ACL

* chore: update go.mod and go.sum with new terraform-plugin-framework-validators version

* feat: add resources for Kafka user, topic, and ACL

* chore: update Kafka topic resource field name to `topic_id`

* feat: update resource example

* feat: update Kafka topic resource field name to `topic_id`
  • Loading branch information
Gezi-lzq authored Aug 8, 2024
1 parent c94948e commit 0f38dbb
Show file tree
Hide file tree
Showing 15 changed files with 1,000 additions and 0 deletions.
52 changes: 52 additions & 0 deletions docs/resources/integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "automq_integration Resource - automq"
subcategory: ""
description: |-
Integration resource
---

# automq_integration (Resource)

Integration resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `endpoint` (String) Endpoint of the integration
- `environment_id` (String) Target environment ID
- `name` (String) Name of the integration
- `type` (String) Type of the integration

### Optional

- `kafka_config` (Attributes) Kafka configuration (see [below for nested schema](#nestedatt--kafka_config))
- `prometheus_config` (Attributes) Prometheus (see [below for nested schema](#nestedatt--prometheus_config))

### Read-Only

- `id` (String) Integration identifier

<a id="nestedatt--kafka_config"></a>
### Nested Schema for `kafka_config`

Required:

- `sasl_mechanism` (String) SASL mechanism for Kafka
- `sasl_password` (String) SASL password for Kafka
- `sasl_username` (String) SASL username for Kafka
- `security_protocol` (String) Security protocol for Kafka


<a id="nestedatt--prometheus_config"></a>
### Nested Schema for `prometheus_config`

Optional:

- `bearer_token` (String) Bearer token
- `password` (String) Password
- `username` (String) Username
31 changes: 31 additions & 0 deletions docs/resources/kafka_acl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "automq_kafka_acl Resource - automq"
subcategory: ""
description: |-
Kafka ACL resource
---

# automq_kafka_acl (Resource)

Kafka ACL resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `environment_id` (String) Target Kafka environment
- `id` (String) Kafka instance ID
- `kafka_instance` (String) Target Kafka instance ID
- `operation_group` (String) Operation group for ACL
- `pattern_type` (String) Pattern type for resource
- `principal` (String) Principal for ACL
- `resource_name` (String) Name of the resource for ACL
- `resource_type` (String) Resource type for ACL

### Optional

- `permission` (String) Permission type for ACL
32 changes: 32 additions & 0 deletions docs/resources/kafka_topic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "automq_kafka_topic Resource - automq"
subcategory: ""
description: |-
Kafka Topic resource
---

# automq_kafka_topic (Resource)

Kafka Topic resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `compact_strategy` (String) Compaction strategy for the Kafka topic
- `environment_id` (String) Target Kafka environment
- `kafka_instance` (String) Target Kafka instance ID
- `name` (String) Name of the Kafka topic

### Optional

- `configs` (Map of String) Additional configuration for the Kafka topic
- `partition` (Number) Number of partitions for the Kafka topic

### Read-Only

- `topic_id` (String) Kafka topic identifier
27 changes: 27 additions & 0 deletions docs/resources/kafka_user.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "automq_kafka_user Resource - automq"
subcategory: ""
description: |-
Kafka User resource
---

# automq_kafka_user (Resource)

Kafka User resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `environment_id` (String) Target environment ID
- `kafka_instance_id` (String) Target Kafka instance ID
- `password` (String) Password for the Kafka user
- `username` (String) Username for the Kafka user

### Read-Only

- `id` (String) Kafka user identifier
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 = "kf-rrn5s50fzpr23urd"
resource_type = "TOPIC"
resource_name = "example-"
pattern_type = "PREFIXED"
principal = "automq_kafka_user"
operation_group = "ALL"
permission = "ALLOW"
}
24 changes: 24 additions & 0 deletions examples/resources/kafka_topic/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_topic" "example" {
environment_id = "example123"
kafka_instance = "kf-rrn5s50fzpr23urd"
name = "example"
partitions = 16
compact_strategy = "DELETE"
config = {
"retention.ms" = "86400000"
}
}
20 changes: 20 additions & 0 deletions examples/resources/kafka_user/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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" {
evnironment_id = "example123"
kafka_instance = "kf-rrn5s50fzpr23urd"
username = "automq_kafka_user"
password = "example"
}
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ require (
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-json v0.22.1 // indirect
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSey
github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA=
github.com/hashicorp/terraform-plugin-framework v1.11.0 h1:M7+9zBArexHFXDx/pKTxjE6n/2UCXY6b8FIq9ZYhwfE=
github.com/hashicorp/terraform-plugin-framework v1.11.0/go.mod h1:qBXLDn69kM97NNVi/MQ9qgd1uWWsVftGSnygYG1tImM=
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0 h1:bxZfGo9DIUoLLtHMElsu+zwqI4IsMZQBRRy4iLzZJ8E=
github.com/hashicorp/terraform-plugin-framework-validators v0.13.0/go.mod h1:wGeI02gEhj9nPANU62F2jCaHjXulejm/X+af4PdZaNo=
github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co=
github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ=
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
Expand Down
Loading

0 comments on commit 0f38dbb

Please sign in to comment.