Unable to override endpoints.s3 on init

I would like to override aws backend configuration on terraform init. It used to work like this:
terraform init -backend-config="endpoint=http://127.0.0.1:9000" but the parameter is now deprecated.

Using
terraform init -backend-config="endpoints.s3=http://127.0.0.1:9000" ends up in error:

terraform init \   
  -backend-config="endpoints.s3=http://127.0.0.1:9000" \                 
  -input=false -reconfigure


Initializing the backend...
Initializing modules...
╷
│ Error: Invalid backend configuration argument
│ 
│ The backend configuration argument "endpoints.s3" given on the command line is not expected for the selected
│ backend type.
╵

I’m using this to point terraform to minio for local testing.

Is there any way how to override s3 backend?

Hi @oto-macenauer-absa,

Assuming that this endpoints argument is expecting a map of strings (which I’ve not checked), the expected syntax would be to assign that whole map, like this:

-backend-config='endpoints={s3="http://127.0.0.1:9000"}'

Thank you @apparentlymart, I’ve tested it and worked as expected!

Hey @oto-macenauer-absa ,
are you tring to configue tfstate backend with minio?
If so, can you please provide working example?

Hi @mrkhachaturov , sure

my backend.tf looks like this:

terraform {
  backend "s3" {
    region = "us-east-1"
    skip_requesting_account_id = true
    skip_credentials_validation = true
    skip_metadata_api_check = true
    skip_region_validation = true
    skip_s3_checksum = true
    use_path_style = true
  }
}

and then I initialize terraform with this command:

terraform init \
  -backend-config="access_key=xxx" \
  -backend-config="secret_key=yyy" \
  -backend-config="bucket=deployment-bucket" \
  -backend-config="key=terraform-local.tfstate" \
  -backend-config='endpoints={s3="http://127.0.0.1:9000"}' \
  -input=false

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.