feat: give the trigger a default name if none is specified

This commit is contained in:
Jose Diaz-Gonzalez committed 2024-11-13 02:14:54 -05:00
1 parent 785af1611c
commit 62f25ad33f
1 file changed
+4 -2
+4 -2
View File
@@ -585,7 +585,7 @@ func getAutoscaling(input GetAutoscalingInput) (ProcessAutoscaling, error) {
} }
triggers := []ProcessAutoscalingTrigger{} triggers := []ProcessAutoscalingTrigger{}
for _, trigger := range config.Triggers { for idx, trigger := range config.Triggers {
if trigger.Type == "" { if trigger.Type == "" {
return ProcessAutoscaling{}, fmt.Errorf("Autoscaling trigger type is required for trigger: index %d", idx) return ProcessAutoscaling{}, fmt.Errorf("Autoscaling trigger type is required for trigger: index %d", idx)
} }
@@ -603,7 +603,9 @@ func getAutoscaling(input GetAutoscalingInput) (ProcessAutoscaling, error) {
metadata[key] = output.String() metadata[key] = output.String()
} }
trigger := ProcessAutoscalingTrigger{ if trigger.Name == "" {
trigger.Name = fmt.Sprintf("trigger-%s-%d", trigger.Type, idx+1)
}
Name: trigger.Name, Name: trigger.Name,
Type: trigger.Type, Type: trigger.Type,
Metadata: metadata, Metadata: metadata,