diff --git a/localstack/config.py b/localstack/config.py index 7f254706fe071..51bcf1f7f8fe6 100644 --- a/localstack/config.py +++ b/localstack/config.py @@ -430,9 +430,6 @@ def in_docker(): # Whether to report internal failures as 500 or 501 errors. FAIL_FAST = is_env_true("FAIL_FAST") -# whether to use the legacy single-region mode, defined via DEFAULT_REGION (DEPRECATED!) -USE_SINGLE_REGION = is_env_true("USE_SINGLE_REGION") - # whether to run in TF compatibility mode for TF integration tests # (e.g., returning verbatim ports for ELB resources, rather than edge port 4566, etc.) TF_COMPAT_MODE = is_env_true("TF_COMPAT_MODE") @@ -1283,7 +1280,7 @@ def use_custom_dns(): "SYNCHRONOUS_SNS_EVENTS", "TEST_AWS_ACCOUNT_ID", "TF_COMPAT_MODE", - "USE_SINGLE_REGION", + "USE_SINGLE_REGION", # Not functional; deprecated in 0.12.7, removed in 3.0.0 "USE_SSL", "WAIT_FOR_DEBUGGER", "WINDOWS_DOCKER_MOUNT_PREFIX", diff --git a/localstack/deprecations.py b/localstack/deprecations.py index d54c16f2b056a..6850b32127c46 100644 --- a/localstack/deprecations.py +++ b/localstack/deprecations.py @@ -47,11 +47,11 @@ def is_affected(self) -> bool: "0.12.8", "PORT_WEB_UI has been removed, and is not available anymore. Please remove this environment variable.", ), - # Since 0.12.7 - Full multi-region support + # Deprecated in 0.12.7, removed in 3.0.0 EnvVarDeprecation( "USE_SINGLE_REGION", "0.12.7", - "LocalStack now has full multi-region support. Please remove this environment variable.", + "LocalStack now has full multi-region support. This option has no effect. Please remove it from your configuration.", # noqa ), EnvVarDeprecation( "DEFAULT_REGION", diff --git a/localstack/runtime/analytics.py b/localstack/runtime/analytics.py index bc3ebb2a074b5..7c05c2060a64b 100644 --- a/localstack/runtime/analytics.py +++ b/localstack/runtime/analytics.py @@ -37,7 +37,7 @@ "REQUIRE_PRO", "SKIP_INFRA_DOWNLOADS", "SQS_ENDPOINT_STRATEGY", - "USE_SINGLE_REGION", + "USE_SINGLE_REGION", # Not functional; deprecated in 0.12.7, removed in 3.0.0 "USE_SSL", ] diff --git a/localstack/services/edge.py b/localstack/services/edge.py index efe4ffa9a4d85..4f77bb6034095 100644 --- a/localstack/services/edge.py +++ b/localstack/services/edge.py @@ -41,7 +41,6 @@ from localstack.utils.aws.aws_stack import ( extract_access_key_id_from_auth_header, is_internal_call_context, - set_default_region_in_headers, ) from localstack.utils.collections import split_list_by from localstack.utils.functions import empty_context_manager @@ -125,8 +124,6 @@ def forward_request(self, method, path, data, headers): if api: port = get_service_port_for_account(api, headers) - set_default_region_in_headers(headers) - should_log_trace = is_trace_logging_enabled(headers) if api and should_log_trace: # print request trace for debugging, if enabled diff --git a/localstack/utils/aws/aws_stack.py b/localstack/utils/aws/aws_stack.py index c80b04f7ef6ec..fc9420e4f82b8 100644 --- a/localstack/utils/aws/aws_stack.py +++ b/localstack/utils/aws/aws_stack.py @@ -200,24 +200,6 @@ def get_s3_hostname(): return LOCALHOST -def set_default_region_in_headers(headers, service=None, region=None): - # this should now be a no-op, as we support arbitrary regions and don't use a "default" region - # TODO: remove this function once the legacy USE_SINGLE_REGION config is removed - if not config.USE_SINGLE_REGION: - return - - auth_header = headers.get("Authorization") - region = region or get_region() - if not auth_header: - if service: - headers["Authorization"] = mock_aws_request_headers(service, region_name=region)[ - "Authorization" - ] - return - replaced = re.sub(r"(.*Credential=[^/]+/[^/]+/)([^/])+/", r"\1%s/" % region, auth_header) - headers["Authorization"] = replaced - - def fix_account_id_in_arns(response, colon_delimiter=":", existing=None, replace=None): """Fix the account ID in the ARNs returned in the given Flask response or string""" existing = existing or ["123456789", "1234567890", "123456789012", get_aws_account_id()] diff --git a/localstack/utils/aws/request_context.py b/localstack/utils/aws/request_context.py index 817f680cecdf6..e4485ef21288d 100644 --- a/localstack/utils/aws/request_context.py +++ b/localstack/utils/aws/request_context.py @@ -107,9 +107,6 @@ def __exit__(self, type, value, traceback): def get_region_from_request_context(): """look up region from request context""" - if config.USE_SINGLE_REGION: - return - request_context = get_request_context() if not request_context: return @@ -197,9 +194,6 @@ def convert_to_flask_response_call(fn, *args, **kwargs): # TODO: publish analytics event ... return requests_to_flask_response(response) - if config.USE_SINGLE_REGION: - return - # make sure that we inherit THREAD_LOCAL request contexts to spawned sub-threads @patch(FuncThread.__init__) def thread_init(fn, self, *args, **kwargs):