Skip to content

error when uses endpoints.s3 #4094

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
Scarbous opened this issue Mar 28, 2025 · 2 comments · May be fixed by #4225
Open
1 of 2 tasks

error when uses endpoints.s3 #4094

Scarbous opened this issue Mar 28, 2025 · 2 comments · May be fixed by #4225
Labels
bug Something isn't working

Comments

@Scarbous
Copy link

Describe the bug

I want to use a custom s3 endpoint endpoints.s3.
It should work since v0.69.12

When I'm right the backend-config should something like:
-backend-config='endpoints={s3="https://s3-nbg1.foo.bar"}'

  ╷
  │ Error: Missing close bracket on index
  │ 
  │   on -backend-config="endpoints=map[s3:https://s3-nbg1.foo.bar]" line 1:
  │   (source code not available)
  │ 
  │ The index operator must end with a closing bracket ("]").
  ╵

Steps To Reproduce

When I run terragrunt init I get the described error.

include "root" {
  path = find_in_parent_folders("root.hcl")
}

remote_state {
  backend = "s3"
  config = {
    endpoints = {
      s3 = "https://s3-nbg1.foo.bar"
    }
    key                                = "${path_relative_to_include()}/tofu.tfstate"
    bucket                             = get_env("STATE_BUCKET")
    region                             = get_env("AWS_REGION")
    skip_bucket_ssencryption           = false
    encrypt                            = false
    skip_credentials_validation        = true
    skip_metadata_api_check            = true
    skip_bucket_public_access_blocking = true
    skip_bucket_ssencryption           = true
    skip_bucket_root_access            = true
    skip_bucket_enforced_tls           = true
    skip_region_validation             = true
    #use_path_style                    = true
    force_path_style                   = true
  }
}

generate "backend" {
  path      = "backend.tf"
  if_exists = "overwrite"
  contents  = <<EOF
terraform {
  backend "s3" {
  }
}
EOF
}

Expected behavior

It uses my custom s3 endpoint

Nice to haves

  • Terminal output
  • Screenshots

Versions

  • Terragrunt version: v0.76.6
  • OpenTofu/Terraform version: Terraform v1.11.2
  • Environment details (Ubuntu 20.04, Windows 10, etc.): alpine
  • Docker image: alpine/terragrunt:1.11.2

Additional context

@Scarbous Scarbous added the bug Something isn't working label Mar 28, 2025
@Scarbous Scarbous changed the title -backend-config="endpoints=map[s3:https://s3-nbg1.nlxnet.de]" error when uses endpoints.s3 Mar 28, 2025
@yhakbar
Copy link
Collaborator

yhakbar commented Apr 4, 2025

@Scarbous , to be honest, I haven't needed to setup a custom s3 endpoint for OpenTofu/Terraform backends, and I don't have experience tackling this kind of configuration. Are you interested in doing some more investigation here, and proposing a solution for your bug?

qhga added a commit to qhga/terragrunt that referenced this issue Apr 29, 2025
@qhga
Copy link

qhga commented Apr 29, 2025

@yhakbar Today I discovered terragrunt and immediately ran into the same problem.
Since this tool could be really useful for my current project, I troubleshooted a bit and the solution should be as follows:

# The value for the enpoint map has to be formatted correctly
-backend-config="endpoints=map[s3:https://object.storage.eu01.mycloud.mep]"
# Input has to be valid json
-backend-config=endpoints='{"s3": "https://object.storage.eu01.mycloud.mep"}'

When manually adjusting this value in the generated command, the custom S3 endpoint works.

I took some time to create a WIP PR #4225 that works, but it still requires proper logging in case the json encoding fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants