Skip to content

Commit

Permalink
Add default value to gateway virtual_cluster attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
qboileau committed Nov 13, 2024
1 parent d249fc6 commit a7285be
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
8 changes: 4 additions & 4 deletions docs/resources/kafka_cluster_v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ resource "conduktor_kafka_cluster_v2" "gateway" {
}
spec {
display_name = "Gateway Cluster"
bootstrap_servers = "gateway:9092"
bootstrap_servers = "gateway:6969"
properties = {
"sasl.jaas.config" = "org.apache.kafka.common.security.plain.PlainLoginModule required username='admin' password='admin-secret';"
"security.protocol" = "SASL_SSL"
Expand All @@ -174,10 +174,10 @@ resource "conduktor_kafka_cluster_v2" "gateway" {
ignore_untrusted_certificate = true
kafka_flavor = {
type = "Gateway"
url = "http://gateway:8088"
url = "http://gateway:8888"
user = "admin"
password = "admin"
virtual_cluster = "vc1"
virtual_cluster = "passthrough"
ignore_untrusted_certificate = true
}
schema_registry = {
Expand Down Expand Up @@ -242,7 +242,7 @@ Optional:
- `service_name` (String) Aiven service name. Required if type is `Aiven`
- `url` (String) Conduktor Gateway Admin API URL. Required if type is `Gateway`
- `user` (String) Conduktor Gateway Admin user. Required if type is `Gateway`
- `virtual_cluster` (String) Conduktor Gateway Virtual cluster name. Only used if type is `Gateway`
- `virtual_cluster` (String) Conduktor Gateway Virtual cluster name (default `passthrough`). Only used if type is `Gateway`


<a id="nestedatt--spec--schema_registry"></a>
Expand Down
6 changes: 3 additions & 3 deletions examples/resources/conduktor_kafka_cluster_v2/gateway.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "conduktor_kafka_cluster_v2" "gateway" {
}
spec {
display_name = "Gateway Cluster"
bootstrap_servers = "gateway:9092"
bootstrap_servers = "gateway:6969"
properties = {
"sasl.jaas.config" = "org.apache.kafka.common.security.plain.PlainLoginModule required username='admin' password='admin-secret';"
"security.protocol" = "SASL_SSL"
Expand All @@ -15,10 +15,10 @@ resource "conduktor_kafka_cluster_v2" "gateway" {
ignore_untrusted_certificate = true
kafka_flavor = {
type = "Gateway"
url = "http://gateway:8088"
url = "http://gateway:8888"
user = "admin"
password = "admin"
virtual_cluster = "vc1"
virtual_cluster = "passthrough"
ignore_untrusted_certificate = true
}
schema_registry = {
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/kafka_cluster_v2_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ func TestAccKafkaClusterV2ExampleResource(t *testing.T) {
resource.TestCheckResourceAttr(gatewayResourceRef, "name", "gateway-cluster"),
resource.TestCheckResourceAttr(gatewayResourceRef, "labels.%", "1"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.display_name", "Gateway Cluster"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.bootstrap_servers", "gateway:9092"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.bootstrap_servers", "gateway:6969"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.properties.%", "3"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.ignore_untrusted_certificate", "true"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.type", "Gateway"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.url", "http://gateway:8088"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.url", "http://gateway:8888"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.user", "admin"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.password", "admin"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.virtual_cluster", "vc1"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.virtual_cluster", "passthrough"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.kafka_flavor.ignore_untrusted_certificate", "true"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.schema_registry.type", "ConfluentLike"),
resource.TestCheckResourceAttr(gatewayResourceRef, "spec.schema_registry.url", "http://localhost:8081"),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions provider_code_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,18 @@
{
"name": "virtual_cluster",
"string": {
"description": "Conduktor Gateway Virtual cluster name. Only used if type is `Gateway`",
"computed_optional_required": "optional"
"description": "Conduktor Gateway Virtual cluster name (default `passthrough`). Only used if type is `Gateway`",
"computed_optional_required": "computed_optional",
"default": {
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
}
],
"schema_definition": "stringdefault.StaticString(\"passthrough\")"
}
}
}
},
{
Expand Down

0 comments on commit a7285be

Please sign in to comment.