Skip to content

[Bug]: Failed to save state .... https response error StatusCode: 400 #314

@oligirling

Description

@oligirling

Current Behavior

When we run terraform apply the state in SOS can be read but when it tries to save the state in SOS it fails.

This is only happening when upgrading terraform >1.6. Works fine on terraform 1.5.7. This could be an issue with terraform but since the issue is happening with the state and the http code is 400, thought i would ask here.

Copy of our provider.tf:

terraform {
  required_providers {
    exoscale = {
      source  = "exoscale/exoscale"
      version = "~> 0.50"
    }
  }
}

provider "exoscale" {
  key    = var.exoscale_vstest_key
  secret = var.exoscale_vstest_secret
}

terraform {
  backend "s3" {
    bucket                      = "bucketname"
    key                         = "terraform.tfstate"
    region                      = "de-muc-1"
    endpoint                    = "https://sos-de-muc-1.exo.io"
    profile                     = "profilename"
    shared_credentials_file     = "terraform.tfstate-credentials.txt"
    skip_region_validation      = true
    skip_credentials_validation = true
    skip_requesting_account_id  = true
    skip_metadata_api_check     = true
    force_path_style            = true
  }
}

Expected Behavior

We run terraform apply and the state is read and written to SOS

Steps To Reproduce

No response

Provider Version

0.53.1

Terraform Version

1.6.3

Relevant log output

exoscale_compute_instance.instancename[3]: Still creating... [30s elapsed]
exoscale_compute_instance.instancename[3]: Creation complete after 34s [id=xxxxxxxxx]
╷
│ Error: Failed to save state
│ 
│ Error saving state: failed to upload state: operation error S3: PutObject, exceeded maximum number of attempts, 5, https response error StatusCode: 400, RequestID:
│ 088a3b3c-ca72-4b64-9796-49049d108f96, HostID: 088a3b3c-ca72-4b64-9796-49049d108f96, api error RequestTimeout: No data received during the last 30 secs.
╵
╷
│ Error: Failed to persist state to backend
│ 
│ The error shown above has prevented Terraform from writing the updated state to the configured backend. To allow for recovery, the state has been written to the file
│ "errored.tfstate" in the current working directory.
│ 
│ Running "terraform apply" again at this point will create a forked state, making it harder to recover.
│ 
│ To retry writing this state, use the following command:
│     terraform state push errored.tfstate

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions