I am trying to deploy bastion host and also trying to push the terraform state file to backend s3 bucket. when I run terraform apply, I get the resources created but at the end I get below error. Could you please advise how should I get this fixed? I have attached the backend code at the bottom.
Failed to save state: failed to upload state: InvalidArgument:
status code: 400, request id: 9576E1B9E59E9703, host id: nLCoeXQkkekQNcuCg0GFyRzySUC97kmrzUO7io06DivPvJH9/Qz5d3USI4XPsKKkgC8Iwk2qeno=
Releasing state lock. This may take a few moments...
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
provider "aws" {
region = "us-east-1"
shared_credentials_file = "~/.aws/credentials"
profile = "default-mfa"
}
terraform {
backend "s3" {
bucket = "my-s3-test-bucket"
key = "prod/terraform.tfstate"
region = "us-east-1"
dynamodb_table = "my-dynamo-test-table-lock"
acl = "Public"
access_key = "AKIAJxxxxxxxxxxxxxxxxxxxxxxxx"
secret_key = "Wxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
}