Skip to content

Commit 0a80bfc

Browse files
committed
docs: clarify security_groups field behavior for FSWAL mode
- Update documentation to clarify that users should omit the field entirely (null) to trigger backend auto-generation, rather than providing an empty list - Empty list [] is rejected by schema validator (SizeAtLeast(1)) - If specified, must contain at least one security group Addresses review comment from PR #100
1 parent 09e419f commit 0a80bfc

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

docs/resources/kafka_instance.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ resource "automq_kafka_instance" "fswal_example" {
9494
file_system_param = {
9595
throughput_mibps_per_file_system = 1000
9696
file_system_count = 2
97-
security_groups = ["sg-example123"] # Optional, auto-generated if not provided. If specified, must contain at least one security group.
97+
security_groups = ["sg-example123"] # Optional. Omit this field entirely to let backend auto-generate. If specified, must contain at least one security group.
9898
}
9999
}
100100
@@ -186,7 +186,7 @@ Required:
186186

187187
Optional:
188188

189-
- `security_groups` (List of String) Security groups for file systems. If not provided, will be auto-generated by the backend.
189+
- `security_groups` (List of String) Security groups for file systems. Omit this field entirely to let backend auto-generate. If specified, must contain at least one security group.
190190

191191

192192
<a id="nestedatt--compute_specs--kubernetes_node_groups"></a>

examples/resources/automq_kafka_instance/resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ resource "automq_kafka_instance" "fswal_example" {
7474
file_system_param = {
7575
throughput_mibps_per_file_system = 1000
7676
file_system_count = 2
77-
security_groups = ["sg-example123"] # Optional, auto-generated if not provided. If specified, must contain at least one security group.
77+
security_groups = ["sg-example123"] # Optional. Omit this field entirely to let backend auto-generate. If specified, must contain at least one security group.
7878
}
7979
}
8080

internal/provider/resource_instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func (r *KafkaInstanceResource) Schema(ctx context.Context, req resource.SchemaR
277277
ElementType: types.StringType,
278278
Optional: true,
279279
Computed: true,
280-
Description: "Security groups for file systems. If not provided, will be auto-generated by the backend.",
280+
Description: "Security groups for file systems. Omit this field entirely to let backend auto-generate. If specified, must contain at least one security group.",
281281
PlanModifiers: []planmodifier.List{
282282
listplanmodifier.RequiresReplace(),
283283
listplanmodifier.UseStateForUnknown(),

internal/provider/resource_instance_validation_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,8 @@ func TestSecurityGroupsValidator(t *testing.T) {
659659

660660
// TestValidateKafkaInstanceConfiguration_FSWALWithEmptySecurityGroups tests that
661661
// FSWAL configuration with empty security_groups list is handled correctly.
662-
// Empty security_groups should be valid (backend will auto-generate).
662+
// Note: Empty list [] is rejected by schema validator (SizeAtLeast(1)).
663+
// Users should omit the field entirely (null) to trigger backend auto-generation.
663664
func TestValidateKafkaInstanceConfiguration_FSWALWithEmptySecurityGroups(t *testing.T) {
664665
plan := &models.KafkaInstanceResourceModel{
665666
ComputeSpecs: &models.ComputeSpecsModel{
@@ -697,7 +698,8 @@ func TestValidateKafkaInstanceConfiguration_FSWALWithEmptySecurityGroups(t *test
697698
}
698699

699700
// TestValidateKafkaInstanceConfiguration_FSWALWithNullSecurityGroups tests that
700-
// FSWAL configuration with null security_groups is valid (backend will auto-generate).
701+
// FSWAL configuration with null security_groups is valid.
702+
// Omitting the field (null) triggers backend auto-generation of security groups.
701703
func TestValidateKafkaInstanceConfiguration_FSWALWithNullSecurityGroups(t *testing.T) {
702704
plan := &models.KafkaInstanceResourceModel{
703705
ComputeSpecs: &models.ComputeSpecsModel{

0 commit comments

Comments
 (0)