Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created August 7, 2022 14:47
Show Gist options
  • Select an option

  • Save KyMidd/9b467a9a989421ce2ea68816792410f6 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/9b467a9a989421ce2ea68816792410f6 to your computer and use it in GitHub Desktop.
# Create secrets directory
directory="/tmp/init-secrets"
try:
print("Creating location for secrets")
os.mkdir(directory)
except OSError as error:
#print(error)
pass
# Find secret values
for secret_name in found_secrets:
secretValue=get_secret_value(secret_name, SecretRegion)
try:
# Create a file if not exist and write to it
fileName="/tmp/init-secrets/{}".format(secret_name)
#print("Attempting to stage secret", secret_name, "at", fileName)
file = open(fileName, "w")
file.write(secretValue)
print("Staged", secret_name, "at", fileName)
except Exception as error:
print(error)
print("Error staging secrets, please investigate")
print(os.listdir("/tmp/init-secrets"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment