File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66import requests
77
88from localstack import config , constants
9+ from localstack .utils .container_networking import get_main_container_ip
910from localstack .utils .net import get_addressable_container_host
1011from localstack_extensions .utils .docker import ProxiedDockerContainerExtension
1112
@@ -140,7 +141,12 @@ def _configure_iam_auth(self, client: hvac.Client):
140141 LOG .info ("Enabled AWS auth method at aws/" )
141142
142143 # Configure the AWS auth to use LocalStack's STS endpoint
143- localstack_endpoint = f"http://{ get_addressable_container_host ()} :{ config .get_edge_port_http ()} "
144+ # Use get_main_container_ip() to get LocalStack's actual container IP
145+ # on the Docker network (e.g., 172.17.0.2), which is reachable from
146+ # the Vault container. get_addressable_container_host() returns the
147+ # Docker gateway IP (172.17.0.1), which may not be accessible.
148+ localstack_ip = get_main_container_ip ()
149+ localstack_endpoint = f"http://{ localstack_ip } :{ config .get_edge_port_http ()} "
144150
145151 client .auth .aws .configure (
146152 sts_endpoint = localstack_endpoint ,
You can’t perform that action at this time.
0 commit comments