Skip to content

Commit aaab877

Browse files
committed
rough working concept
1 parent 370f6d5 commit aaab877

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

internal/configuration/configuration.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ type ResourceConfig struct {
3232
// A list of processor names to attach to the resource
3333
Processors []string
3434

35+
// RouteID is the ID to use when routing to this resource
36+
RouteID string
37+
3538
// Routes to attach to the resource
3639
Routes *model.Routes
3740
}
@@ -196,6 +199,8 @@ func withResourcesByName(r []ResourceConfig) []model.ResourceConfiguration {
196199
processorResources = append(processorResources, processor)
197200
}
198201

202+
routeID := r.RouteID
203+
199204
// Build source resource with name and list
200205
// of processor resources
201206
r := model.ResourceConfiguration{
@@ -205,6 +210,10 @@ func withResourcesByName(r []ResourceConfig) []model.ResourceConfiguration {
205210
},
206211
Routes: r.Routes,
207212
}
213+
if routeID != "" {
214+
r.ID = routeID
215+
}
216+
208217
resources = append(resources, r)
209218
}
210219
return resources

provider/resource_configuration_v2.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,12 @@ func resourceConfigurationV2() *schema.Resource {
145145
ForceNew: false,
146146
Elem: &schema.Resource{
147147
Schema: map[string]*schema.Schema{
148+
"route_id": {
149+
Type: schema.TypeString,
150+
Required: true,
151+
ForceNew: false,
152+
Description: "The ID to use for routing to this destination.",
153+
},
148154
"name": {
149155
Type: schema.TypeString,
150156
Required: true,
@@ -353,6 +359,7 @@ func resourceConfigurationV2Create(d *schema.ResourceData, meta any) error {
353359
}
354360

355361
destConfig := configuration.ResourceConfig{
362+
RouteID: destinationRaw["route_id"].(string),
356363
Name: destinationRaw["name"].(string),
357364
Processors: processors,
358365
}

test/local/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ resource "bindplane_configuration_v2" "configuration" {
331331
}
332332

333333
destination {
334+
route_id = bindplane_destination.custom.id
334335
name = bindplane_destination.custom.name
335336
processors = [
336337
bindplane_processor.batch.name,

0 commit comments

Comments
 (0)