8000 Init hooks: Remove default AWS credentials · localstack/localstack@48740ad · GitHub
[go: up one dir, main page]

Skip to content

Commit 48740ad

Browse files
Init hooks: Remove default AWS credentials
1 parent 9b8d0e1 commit 48740ad

File tree

1 file changed

+0
-15
lines changed
  • localstack-core/localstack/runtime

1 file changed

+0
-15
lines changed

localstack-core/localstack/runtime/init.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
from plux import Plugin, PluginManager
1313

14-
from localstack import constants
1514
from localstack.runtime import hooks
1615
from localstack.utils.objects import singleton_factory
1716

@@ -156,13 +155,6 @@ def run_stage(self, stage: Stage) -> List[Script]:
156155
for script in scripts:
157156
LOG.debug("Running %s script %s", script.stage, script.path)
158157

159-
# Deprecated: To be removed in v4.0 major release.
160-
# Explicit AWS credentials and region will need to be set in the script.
161-
env_original = os.environ.copy()
162-
os.environ["AWS_ACCESS_KEY_ID"] = constants.DEFAULT_AWS_ACCOUNT_ID
163-
os.environ["AWS_SECRET_ACCESS_KEY"] = constants.INTERNAL_AWS_SECRET_ACCESS_KEY
164-
os.environ["AWS_REGION"] = constants.AWS_REGION_US_EAST_1
165-
166158
try:
167159
script.state = State.RUNNING
168160
runner = self.get_script_runner(script.path)
@@ -175,13 +167,6 @@ def run_stage(self, stage: Stage) -> List[Script]:
175167
LOG.error("Error while running script %s: %s", script, e)
176168
else:
177169
script.state = State.SUCCESSFUL
178-
finally:
179-
# Restore original state of Boto credentials.
180-
for env_var in ("AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_REGION"):
181-
if env_var in env_original:
182-
os.environ[env_var] = env_original[env_var]
183-
else:
184-
os.environ.pop(env_var, None)
185170

186171
finally:
187172
self.stage_completed[stage] = True

0 commit comments

Comments
 (0)
0