Skip to content

Commit 5656ef6

Browse files
Mirror from monorepo f765d071 (#676)
Automated mirror from monorepo commit `f765d071d781a0a07f00e38b5baae6b8ce7a78b4`. This PR was automatically generated by the terraform provider mirroring workflow. Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 0a65355 commit 5656ef6

File tree

5 files changed

+40
-11
lines changed

5 files changed

+40
-11
lines changed

docs/resources/connector_configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Registering a Connector Configuration with Formal.
2222
### Optional
2323

2424
- `log_level` (String) The log level to be configured for this Connector.
25+
- `otel_endpoint_hostname` (String) The OpenTelemetry endpoint hostname for this Connector. Defaults to 'localhost'.
26+
- `otel_endpoint_port` (Number) The OpenTelemetry endpoint port for this Connector. Defaults to 4317.
2527
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
2628

2729
### Read-Only

examples/deployments/aws/connector/connector/formal.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ resource "formal_connector" "main" {
2020
resource "formal_connector_configuration" "main" {
2121
connector_id = formal_connector.main.id
2222
log_level = "debug"
23+
otel_endpoint_hostname = "localhost"
24+
otel_endpoint_port = 4317
2325
}
2426

2527

formal/resources/resource_connector_configuration.go

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,20 @@ func ResourceConnectorConfiguration() *schema.Resource {
5252
Optional: true,
5353
Default: "info",
5454
},
55+
"otel_endpoint_hostname": {
56+
// This description is used by the documentation generator and the language server.
57+
Description: "The OpenTelemetry endpoint hostname for this Connector. Defaults to 'localhost'.",
58+
Type: schema.TypeString,
59+
Optional: true,
60+
Default: "localhost",
61+
},
62+
"otel_endpoint_port": {
63+
// This description is used by the documentation generator and the language server.
64+
Description: "The OpenTelemetry endpoint port for this Connector. Defaults to 4317.",
65+
Type: schema.TypeInt,
66+
Optional: true,
67+
Default: 4317,
68+
},
5569
},
5670
}
5771
}
@@ -63,9 +77,14 @@ func resourceConnectorConfigurationCreate(ctx context.Context, d *schema.Resourc
6377
// Warning or errors can be collected in a slice type
6478
var diags diag.Diagnostics
6579

80+
otelHostname := d.Get("otel_endpoint_hostname").(string)
81+
otelPort := int32(d.Get("otel_endpoint_port").(int))
82+
6683
req := &corev1.CreateConnectorConfigurationRequest{
67-
ConnectorId: d.Get("connector_id").(string),
68-
LogLevel: d.Get("log_level").(string),
84+
ConnectorId: d.Get("connector_id").(string),
85+
LogLevel: d.Get("log_level").(string),
86+
OtelEndpointHostname: &otelHostname,
87+
OtelEndpointPort: &otelPort,
6988
}
7089

7190
res, err := c.Grpc.Sdk.ConnectorServiceClient.CreateConnectorConfiguration(ctx, connect.NewRequest(req))
@@ -103,6 +122,8 @@ func resourceConnectorConfigurationRead(ctx context.Context, d *schema.ResourceD
103122
d.Set("id", res.Msg.ConnectorConfiguration.Id)
104123
d.Set("connector_id", res.Msg.ConnectorConfiguration.ConnectorId)
105124
d.Set("log_level", res.Msg.ConnectorConfiguration.LogLevel)
125+
d.Set("otel_endpoint_hostname", res.Msg.ConnectorConfiguration.OtelEndpointHostname)
126+
d.Set("otel_endpoint_port", res.Msg.ConnectorConfiguration.OtelEndpointPort)
106127

107128
d.SetId(res.Msg.ConnectorConfiguration.Id)
108129

@@ -118,17 +139,21 @@ func resourceConnectorConfigurationUpdate(ctx context.Context, d *schema.Resourc
118139

119140
connectorConfigurationId := d.Id()
120141

121-
fieldsThatCanChange := []string{"log_level"}
142+
fieldsThatCanChange := []string{"log_level", "otel_endpoint_hostname", "otel_endpoint_port"}
122143
if d.HasChangesExcept(fieldsThatCanChange...) {
123144
err := fmt.Sprintf("At the moment you can only update the following fields: %s. If you'd like to update other fields, please message the Formal team and we're happy to help.", strings.Join(fieldsThatCanChange, ", "))
124145
return diag.FromErr(errors.New(err))
125146
}
126147

127148
logLevel := d.Get("log_level").(string)
149+
otelHostname := d.Get("otel_endpoint_hostname").(string)
150+
otelPort := int32(d.Get("otel_endpoint_port").(int))
128151

129152
req := connect.NewRequest(&corev1.UpdateConnectorConfigurationRequest{
130-
Id: connectorConfigurationId,
131-
LogLevel: &logLevel,
153+
Id: connectorConfigurationId,
154+
LogLevel: &logLevel,
155+
OtelEndpointHostname: &otelHostname,
156+
OtelEndpointPort: &otelPort,
132157
})
133158

134159
_, err := c.Grpc.Sdk.ConnectorServiceClient.UpdateConnectorConfiguration(ctx, req)

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require (
3434
)
3535

3636
require (
37-
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.11-20260111010430-a70d63ed48b3.1
37+
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.11-20260115232218-b7f298826cda.1
3838
github.com/fatih/color v1.16.0 // indirect
3939
github.com/formalco/go-sdk/sdk/v2 v2.11.0
4040
github.com/golang/protobuf v1.5.4 // indirect
@@ -51,7 +51,7 @@ require (
5151
)
5252

5353
require (
54-
buf.build/gen/go/formal/core/connectrpc/go v1.19.1-20260111010430-a70d63ed48b3.2 // indirect
54+
buf.build/gen/go/formal/core/connectrpc/go v1.19.1-20260115232218-b7f298826cda.2 // indirect
5555
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.11-20241220201140-4c5ba75caaf8.1 // indirect
5656
cel.dev/expr v0.24.0 // indirect
5757
dario.cat/mergo v1.0.1 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20251209175733-2a1774d88802.1 h1:j9yeqTWEFrtimt8Nng2MIeRrpoCvQzM9/g25XTvqUGg=
22
buf.build/gen/go/bufbuild/protovalidate/protocolbuffers/go v1.36.11-20251209175733-2a1774d88802.1/go.mod h1:tvtbpgaVXZX4g6Pn+AnzFycuRK3MOz5HJfEGeEllXYM=
3-
buf.build/gen/go/formal/core/connectrpc/go v1.19.1-20260111010430-a70d63ed48b3.2 h1:wHzItIiCGfEI9CTq08rAwdlOt+a+nId52aRtPVRBfew=
4-
buf.build/gen/go/formal/core/connectrpc/go v1.19.1-20260111010430-a70d63ed48b3.2/go.mod h1:+i+Lr348/b9WDY2ptZ2qkAxEOgULQD3DCo6L/KoU/Q0=
5-
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.11-20260111010430-a70d63ed48b3.1 h1:HKyH7PPe+pgwGkLPiK0V1XCue+PfvNjBdJw9Zo6th+A=
6-
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.11-20260111010430-a70d63ed48b3.1/go.mod h1:1dHiBGQoihkXZQkToxnFLSdzNSqSBKXROUMlOnbPcQY=
3+
buf.build/gen/go/formal/core/connectrpc/go v1.19.1-20260115232218-b7f298826cda.2 h1:1XoEt8FxSkX65Qq8N3F1p82f3jsgr+ZXiC3AmIki1xs=
4+
buf.build/gen/go/formal/core/connectrpc/go v1.19.1-20260115232218-b7f298826cda.2/go.mod h1:G/6IbnqBiE6izn8sFUs2Vgx7h2hVWaE2jaM8oknv4iI=
5+
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.11-20260115232218-b7f298826cda.1 h1:09lVAX8QCOA4f3sobtNF4zLruTOUm3gWQx0CBzytdB4=
6+
buf.build/gen/go/formal/core/protocolbuffers/go v1.36.11-20260115232218-b7f298826cda.1/go.mod h1:1dHiBGQoihkXZQkToxnFLSdzNSqSBKXROUMlOnbPcQY=
77
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.11-20241220201140-4c5ba75caaf8.1 h1:cpnZuwF24ackV1HgofmoFNsdw9z4/066sujIFtxYg5g=
88
buf.build/gen/go/grpc-ecosystem/grpc-gateway/protocolbuffers/go v1.36.11-20241220201140-4c5ba75caaf8.1/go.mod h1:KAAU6zfI4aGOR/SiWil31PiNwdpo1SlqZidcB3z+sL0=
99
buf.build/go/protovalidate v0.14.0 h1:kr/rC/no+DtRyYX+8KXLDxNnI1rINz0imk5K44ZpZ3A=

0 commit comments

Comments
 (0)