ripe-xylophone-26538
03/12/2024, 3:45 PMfrom pulumi import Config
password = config.require_secret("password")
def read_config(tpl, substitutes):
with open(tpl, "r") as template:
yml = template.read()
yml = string.Template(yml)
yml = yml.substitute(substitutes)
sp = subprocess.run(["butane"], input=yml, shell=True, capture_output=True, encoding='utf8')
if sp.returncode == 0:
return str(base64.b64encode(sp.stdout.encode('ascii')), encoding='ascii')
else:
log.error('Failed to run butane')
print(read_config("tpl.yaml", {"password": password})
ripe-xylophone-26538
03/12/2024, 3:46 PM.apply
but I never get my password anywhere as plain text...adventurous-butcher-54166
03/12/2024, 5:08 PMadventurous-butcher-54166
03/12/2024, 5:09 PMripe-xylophone-26538
03/13/2024, 7:26 AMripe-xylophone-26538
03/13/2024, 10:15 AMyaml.dump
for that? I just want to feed the yaml as string into the pulumi vm resource and don't need a file for that? Just seeing that it does not work straightforward with my code above. (Sorry, noob in python). Anything preventing me from using the read_config
as above?ripe-xylophone-26538
03/13/2024, 11:03 AMripe-xylophone-26538
03/13/2024, 11:03 AM