feat: support per-remote upstream timeouts
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful

Add upstream_dial_timeout, upstream_tls_timeout and
upstream_response_header_timeout (seconds; 0 = server default) to the
remote resource and data source, matching the artifactapi server. Wire
them through the API model, schema, create/read/update mapping, docs and
unit tests.
This commit is contained in:
2026-07-02 22:19:39 +10:00
parent 0b4db409b0
commit 4dd290518d
5 changed files with 76 additions and 0 deletions
+12
View File
@@ -45,6 +45,10 @@ func (d *remoteDataSource) Schema(_ context.Context, _ datasource.SchemaRequest,
"stale_on_error": schema.BoolAttribute{Computed: true},
"releases_remote": schema.StringAttribute{Computed: true},
"managed_by": schema.StringAttribute{Computed: true},
"upstream_dial_timeout": schema.Int64Attribute{Computed: true},
"upstream_tls_timeout": schema.Int64Attribute{Computed: true},
"upstream_response_header_timeout": schema.Int64Attribute{Computed: true},
},
}
}
@@ -68,6 +72,10 @@ type remoteDataSourceModel struct {
StaleOnError types.Bool `tfsdk:"stale_on_error"`
ReleasesRemote types.String `tfsdk:"releases_remote"`
ManagedBy types.String `tfsdk:"managed_by"`
UpstreamDialTimeout types.Int64 `tfsdk:"upstream_dial_timeout"`
UpstreamTLSTimeout types.Int64 `tfsdk:"upstream_tls_timeout"`
UpstreamResponseHeaderTimeout types.Int64 `tfsdk:"upstream_response_header_timeout"`
}
func (d *remoteDataSource) Configure(_ context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) {
@@ -114,6 +122,10 @@ func (d *remoteDataSource) Read(ctx context.Context, req datasource.ReadRequest,
StaleOnError: types.BoolValue(remote.StaleOnError),
ReleasesRemote: types.StringValue(remote.ReleasesRemote),
ManagedBy: types.StringValue(remote.ManagedBy),
UpstreamDialTimeout: types.Int64Value(remote.UpstreamDialTimeout),
UpstreamTLSTimeout: types.Int64Value(remote.UpstreamTLSTimeout),
UpstreamResponseHeaderTimeout: types.Int64Value(remote.UpstreamResponseHeaderTimeout),
}
resp.Diagnostics.Append(resp.State.Set(ctx, state)...)
}