@@ -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 )
0 commit comments