@@ -864,7 +864,11 @@ func (h *TfeHandler) GetCurrentStateVersion(c echo.Context) error {
864864 stateVersionID := generateStateVersionID (stateID , stateMeta .Updated .Unix ())
865865
866866 baseURL := getBaseURL (c )
867- downloadURL := fmt .Sprintf ("%s/tfe/api/v2/state-versions/%s/download" , baseURL , stateVersionID )
867+ // Sign the download URL for Terraform 1.5.x compatibility (doesn't send auth headers)
868+ downloadURL , err := auth .SignURL (baseURL , fmt .Sprintf ("/tfe/api/v2/state-versions/%s/download" , stateVersionID ), time .Now ().Add (10 * time .Minute ))
869+ if err != nil {
870+ return c .JSON (500 , map [string ]string {"error" : "Failed to sign download URL" })
871+ }
868872
869873 // Return current state version info
870874 return c .JSON (200 , map [string ]interface {}{
@@ -1174,7 +1178,7 @@ func (h *TfeHandler) DownloadStateVersion(c echo.Context) error {
11741178 unitUUID := extractUnitUUID (stateID )
11751179
11761180 // Download the state data
1177- stateData , err := h .stateStore .Download (c .Request ().Context (), unitUUID )
1181+ stateData , err := h .directStateStore .Download (c .Request ().Context (), unitUUID )
11781182 if err != nil {
11791183 if err == storage .ErrNotFound {
11801184 return c .JSON (404 , map [string ]string {"error" : "State version not found" })
@@ -1359,7 +1363,11 @@ func (h *TfeHandler) ShowStateVersion(c echo.Context) error {
13591363 }
13601364
13611365 baseURL := getBaseURL (c )
1362- downloadURL := fmt .Sprintf ("%s/tfe/api/v2/state-versions/%s/download" , baseURL , id )
1366+ // Sign the download URL for Terraform 1.5.x compatibility
1367+ downloadURL , err := auth .SignURL (baseURL , fmt .Sprintf ("/tfe/api/v2/state-versions/%s/download" , id ), time .Now ().Add (10 * time .Minute ))
1368+ if err != nil {
1369+ return c .JSON (500 , map [string ]string {"error" : "Failed to sign download URL" })
1370+ }
13631371
13641372 resp := map [string ]interface {}{
13651373 "data" : map [string ]interface {}{
0 commit comments