icy-chef-34317
08/03/2024, 8:46 PMblob_conn_string=pulumi.Output.all(env_storage.name, env_storage_key).apply(lambda args: f'DefaultEndpointsProtocol: https;AccountName: {args[0]};AccountKey: {args[1]} ;EndpointSuffix: core.windows.net')
The connection string is fine, it's properly formed, all is good. I know it's an Output type, etc.
That connection string is supposed to be placed in a Github Actions secret. In order to create said secret the value of connection string needs to be encrypted
# this uses the pynacl
def encrypt_github_action_secret(public_encryption_key: str, secret_value: str) -> str:
public_key = public.PublicKey(public_encryption_key.encode("utf-8"), encoding.Base64Encoder())
sealed_box = public.SealedBox(public_key)
encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
return b64encode(encrypted).decode("utf-8")
encrypt_github_action_secret(public_encryption_key=public_key, secret_value=blob_conn_string)
The problem is I can't use Output for this, I need a damn string and I am out of options on how to convert the damn Output to a string (or some other form that the encrypting function can use, at this point I am not really picky).
According to the documentation (what little there is, and I have given up on the Pulumi Artificial Idiot) the answer to this horror show basically boils down to doing everything within the apply.
Any and all pointers would be more than welcome.dry-keyboard-94795
08/03/2024, 9:36 PMdry-keyboard-94795
08/03/2024, 9:38 PMblob_conn_enc = blob_conn_string.apply(lambda bc: encrypt_github_action_secret(public_key, bc))
icy-chef-34317
08/05/2024, 11:44 AMdry-keyboard-94795
08/05/2024, 11:59 AM.apply
method