Skip to content

Commit e329fd2

Browse files
fix comments
1 parent a53b7ae commit e329fd2

File tree

8 files changed

+25
-15
lines changed

8 files changed

+25
-15
lines changed

docs/data-sources/connectors.md

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Read-Only:
3636
- `group_id` (String) The unique identifier for the Group (Destination) within the Fivetran system.
3737
- `hybrid_deployment_agent_id` (String) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.
3838
- `id` (String) The unique identifier for the connector within the Fivetran system.
39-
- `local_processing_agent_id` (String) (Deprecated) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.
4039
- `name` (String) The name used both as the connector's name within the Fivetran system and as the source schema's name within your destination.
4140
- `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent.
4241
- `pause_after_trial` (Boolean) Specifies whether the connector should be paused after the free trial period has ended.

docs/data-sources/destinations.md

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Read-Only:
3131
- `group_id` (String) The unique identifier for the Group within the Fivetran system.
3232
- `hybrid_deployment_agent_id` (String) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.
3333
- `id` (String) The unique identifier for the destination within the Fivetran system.
34-
- `local_processing_agent_id` (String) (Deprecated) The hybrid deployment agent ID that refers to the controller created for the group the connection belongs to. If the value is specified, the system will try to associate the connection with an existing agent.
3534
- `networking_method` (String) Possible values: Directly, SshTunnel, ProxyAgent.
3635
- `private_link_id` (String) The private link ID.
3736
- `region` (String) Data processing location. This is where Fivetran will operate and run computation on data.

fivetran/framework/core/model/connectors.go

-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func (d *Connectors) ReadFromResponse(ctx context.Context, resp connectors.Conne
3434
"data_delay_threshold": types.Int64Type,
3535
"proxy_agent_id": types.StringType,
3636
"networking_method": types.StringType,
37-
"local_processing_agent_id": types.StringType,
3837
"hybrid_deployment_agent_id": types.StringType,
3938
"private_link_id": types.StringType,
4039
}
@@ -65,7 +64,6 @@ func (d *Connectors) ReadFromResponse(ctx context.Context, resp connectors.Conne
6564
item["data_delay_threshold"] = types.Int64Value(int64(*v.DataDelayThreshold))
6665
item["proxy_agent_id"] = types.StringValue(v.ProxyAgentId)
6766
item["networking_method"] = types.StringValue(v.NetworkingMethod)
68-
item["local_processing_agent_id"] = types.StringValue(v.HybridDeploymentAgentId)
6967
item["hybrid_deployment_agent_id"] = types.StringValue(v.HybridDeploymentAgentId)
7068
item["private_link_id"] = types.StringValue(v.PrivateLinkId)
7169

fivetran/framework/core/model/destinations.go

-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ func (d *Destinations) ReadFromResponse(ctx context.Context, resp destinations.D
2222
"time_zone_offset": types.StringType,
2323
"setup_status": types.StringType,
2424
"networking_method": types.StringType,
25-
"local_processing_agent_id": types.StringType,
2625
"hybrid_deployment_agent_id": types.StringType,
2726
"private_link_id": types.StringType,
2827
"daylight_saving_time_enabled": types.BoolType,
@@ -43,7 +42,6 @@ func (d *Destinations) ReadFromResponse(ctx context.Context, resp destinations.D
4342
item["time_zone_offset"] = types.StringValue(v.TimeZoneOffset)
4443
item["setup_status"] = types.StringValue(v.SetupStatus)
4544
item["private_link_id"] = types.StringValue(v.PrivateLinkId)
46-
item["local_processing_agent_id"] = types.StringValue(v.HybridDeploymentAgentId)
4745
item["hybrid_deployment_agent_id"] = types.StringValue(v.HybridDeploymentAgentId)
4846
item["networking_method"] = types.StringValue(v.NetworkingMethod)
4947
item["daylight_saving_time_enabled"] = types.BoolValue(v.DaylightSavingTimeEnabled)

fivetran/framework/datasources/connectors_test.go

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ const (
3939
"data_delay_threshold": 0,
4040
"data_delay_sensitivity": "LOW",
4141
"schedule_type": "auto",
42-
"local_processing_agent_id": "string",
4342
"hybrid_deployment_agent_id": "string"
4443
}
4544
],
@@ -70,7 +69,6 @@ const (
7069
"data_delay_threshold": 0,
7170
"data_delay_sensitivity": "LOW",
7271
"schedule_type": "auto",
73-
"local_processing_agent_id": "string",
7472
"hybrid_deployment_agent_id": "string"
7573
}
7674
],

fivetran/framework/resources/connector_migrations.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ func upgradeConnectorState(ctx context.Context, req resource.UpgradeStateRequest
3535
return
3636
}
3737

38-
lpaValue := tftypes.NewValue(tftypes.String, nil)
38+
resultValue := tftypes.NewValue(tftypes.String, nil)
3939
if fromVersion == 3 || fromVersion == 4 {
40-
lpaValue = rawState["local_processing_agent_id"]
40+
if !rawState["hybrid_deployment_agent_id"].IsNull() {
41+
resultValue = rawState["hybrid_deployment_agent_id"]
42+
} else if !rawState["local_processing_agent_id"].IsNull() {
43+
resultValue = rawState["local_processing_agent_id"]
44+
}
4145
}
4246

4347
dynamicValue, err := tfprotov6.NewDynamicValue(
@@ -55,7 +59,7 @@ func upgradeConnectorState(ctx context.Context, req resource.UpgradeStateRequest
5559
"private_link_id": tftypes.NewValue(tftypes.String, nil),
5660
"data_delay_sensitivity": tftypes.NewValue(tftypes.String, nil),
5761
"data_delay_threshold": tftypes.NewValue(tftypes.Number, nil),
58-
"hybrid_deployment_agent_id": lpaValue,
62+
"hybrid_deployment_agent_id": resultValue,
5963
"run_setup_tests": convertStringStateValueToBool("run_setup_tests", rawState["run_setup_tests"], resp.Diagnostics),
6064
"trust_fingerprints": convertStringStateValueToBool("trust_fingerprints", rawState["trust_fingerprints"], resp.Diagnostics),
6165
"trust_certificates": convertStringStateValueToBool("trust_certificates", rawState["trust_certificates"], resp.Diagnostics),

fivetran/framework/resources/destination.go

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ func (r *destination) UpgradeState(ctx context.Context) map[int64]resource.State
5959
upgradeDestinationState(ctx, req, resp, 2)
6060
},
6161
},
62+
3: {
63+
StateUpgrader: func(ctx context.Context, req resource.UpgradeStateRequest, resp *resource.UpgradeStateResponse) {
64+
upgradeDestinationState(ctx, req, resp, 3)
65+
},
66+
},
6267
}
6368
}
6469

fivetran/framework/resources/destination_migrations.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ func upgradeDestinationState(ctx context.Context, req resource.UpgradeStateReque
3131
return
3232
}
3333

34+
resultValue := tftypes.NewValue(tftypes.String, nil)
35+
if fromVersion == 1 || fromVersion == 2 {
36+
if !rawState["hybrid_deployment_agent_id"].IsNull() {
37+
resultValue = rawState["hybrid_deployment_agent_id"]
38+
} else if !rawState["local_processing_agent_id"].IsNull() {
39+
resultValue = rawState["local_processing_agent_id"]
40+
}
41+
}
42+
3443
dynamicValue, err := tfprotov6.NewDynamicValue(
35-
getDestinationStateModel(3),
36-
tftypes.NewValue(getDestinationStateModel(3), map[string]tftypes.Value{
44+
getDestinationStateModel(4),
45+
tftypes.NewValue(getDestinationStateModel(4), map[string]tftypes.Value{
3746
"id": rawState["id"],
3847
"group_id": rawState["group_id"],
3948
"service": rawState["service"],
@@ -44,7 +53,7 @@ func upgradeDestinationState(ctx context.Context, req resource.UpgradeStateReque
4453
"daylight_saving_time_enabled": tftypes.NewValue(tftypes.Bool, nil),
4554
"networking_method": tftypes.NewValue(tftypes.String, nil),
4655
"private_link_id": tftypes.NewValue(tftypes.String, nil),
47-
"hybrid_deployment_agent_id": rawState["hybrid_deployment_agent_id"],
56+
"hybrid_deployment_agent_id": resultValue,
4857
"run_setup_tests": convertStringStateValueToBool("run_setup_tests", rawState["run_setup_tests"], resp.Diagnostics),
4958
"trust_fingerprints": convertStringStateValueToBool("trust_fingerprints", rawState["trust_fingerprints"], resp.Diagnostics),
5059
"trust_certificates": convertStringStateValueToBool("trust_certificates", rawState["trust_certificates"], resp.Diagnostics),
@@ -75,7 +84,7 @@ func getDestinationStateModel(version int) tftypes.Type {
7584
},
7685
},
7786
}
78-
if version == 3 {
87+
if version == 3 || version == 4 {
7988
base["run_setup_tests"] = tftypes.Bool
8089
base["trust_certificates"] = tftypes.Bool
8190
base["trust_fingerprints"] = tftypes.Bool

0 commit comments

Comments
 (0)