I want to store the terraform state in the OVHcloud (S3) Object Storage. My code is given below:
backend "s3" {
bucket = "terraform-state-object-storage"
key = "ingress-nginx/terraform.tfstate"
region = "de"
skip_credentials_validation = true
skip_region_validation = true
endpoints = {
s3 = "https://s3.de.io.cloud.ovh.net"
}
}
I have also placed my aws_access_key_id and aws_secret_access_key in the ~/.aws/credentials directory. But I am getting this error when I type terraform init command
Initializing the backend…
╷
│ Error: Retrieving AWS account details: AWS account ID not previously found and failed retrieving via all available methods. See https://www.terraform.io/docs/providers/aws/index.html#skip_requesting_account_id for workaround and implications. Errors: 2 errors occurred:
│ * retrieving caller identity from STS: operation error STS: GetCallerIdentity, https response error StatusCode: 0, RequestID: , request send failed, Post "https://sts.de.amazonaws.com/": dial tcp: lookup sts.de.amazonaws.com: no such host
│ * retrieving account information via iam:ListRoles: operation error IAM: ListRoles, https response error StatusCode: 403, RequestID: fd715fda-d111-4db0-807b-517da1db165f, api error InvalidClientTokenId: The security token included in the request is invalid.
I had successfully created the bucket by following this tutorial using command line https://help.ovhcloud.com/csm/en-public-cloud-storage-s3-getting-started-object-storage?id=kb_article_view&sysparm_article=KB0047348 but the problem occurs when I try to use that bucket to store terraform state. My ovh provider version is given below:
ovh = {
source = "ovh/ovh"
version = ">= 0.35.0"
} Can anyone tell me how can I fix this issue? Thanks