rich-agency-75207
05/31/2022, 1:42 PMoptions:
additionalSecretOutputs:
- privateKeyData
This ensured that the corresponding output is [secret]
and the json key is, indeed, obfuscated; however, it has only been base64 encoded as opposed to encrypted using GCP's KMS service.
Clearly I've missed a step in this process and/or have too high expectations wrt pulumi's encoding scheme if the secrets provider is changed.
Please can someone clarify?echoing-dinner-19531
05/31/2022, 1:52 PMconfig set --secret
) encrypted?rich-agency-75207
05/31/2022, 1:54 PMpulumi config set --secret deploy_key $(pulumi stack output deploy_sa_key --show-secrets | base64 --decode --ignore-garbage)
echoing-dinner-19531
05/31/2022, 2:00 PMrich-agency-75207
05/31/2022, 2:04 PMpulumi stack change-secrets-provider "<gcpkms://projects/*****/locations/*****/keyRings/*****/cryptoKeys/****>"
Migrating old configuration and state to new secrets provider
echoing-dinner-19531
05/31/2022, 2:08 PMrich-agency-75207
05/31/2022, 2:23 PMsecretsprovider
⢠encryptedkey
My secrets provider value is correct as per the command above.
fyi - creating secret config entries does work - they are definitely encrypted and not base64 encoded either. (As opposed to my situation described in my opening statement - I'll circle back to that once I've resolved this immediate issue).
To test encryption via KMS I take the secret key value and run it through a gcloud kms decrypt command.
It complains that the ciphertext is not valid.
I suspect my expectation that the same kms key will not be able to decrypt this value and it may have something to do with the encrypted key now stored in the config file..?echo '{the encrypted xx value}' | gcloud kms decrypt...
to decrypt a key value added via pulumi config set --secret xx aa
echoing-dinner-19531
05/31/2022, 2:38 PMIt complains that the ciphertext is not valid.It won't be. We encrypt a symmetrical key using KMS but then all the values are just AES256 encrypted with that key, they don't go through KMS.
rich-agency-75207
05/31/2022, 2:43 PMechoing-dinner-19531
05/31/2022, 2:44 PMrich-agency-75207
05/31/2022, 2:45 PMpulumi config get {secret}
- returns the unencrypted value - haechoing-dinner-19531
05/31/2022, 2:49 PMrich-agency-75207
05/31/2022, 2:51 PMpulumi config set --secret deploy_key "$(pulumi stack output deploy_sa_key --show-secrets | base64 --decode --ignore-garbage)"
to generate the config secret key value
Is there a way to auto-generate the config entry when the key resource is created (am using pulumi google-native yaml)echoing-dinner-19531
05/31/2022, 2:54 PMIs there a way to auto-generate the config entry when the key resource is created (am using pulumi google-native yaml)I don't think so, the engine needs to know about the key somehow.
privateKeyData
I bet that needs to be private_key_data
for additionalSecretOutputsrich-agency-75207
05/31/2022, 2:58 PMechoing-dinner-19531
05/31/2022, 3:02 PMstack output
? Because that will also (like config get) decode for you.rich-agency-75207
05/31/2022, 3:02 PMechoing-dinner-19531
05/31/2022, 3:04 PMrich-agency-75207
05/31/2022, 3:04 PMprivateKeyData
vs private_key_data
The value is still base64 encoded but the value does propagate. (I am assuming that the output var is updated on pulumi up -y
and/or use of pulumi refresh
echoing-dinner-19531
05/31/2022, 3:06 PMprivateKeyData
would of just been ignored, that's what I think we should warn about "hey you asked for key X to be secret but we couldn't find a key X"
I'm not sure about why the value is base64 encoded but doesn't seem encrypted, but yes up
or refresh
should of updated the state to have the latest value for it.rich-agency-75207
05/31/2022, 3:08 PMprivateKeyData
wasn't ignored tho as the json key was propagated to pulumi.com[secret]
and returns a base64 string when using stack output. (Just to ensure no confusion)echoing-dinner-19531
05/31/2022, 3:11 PMrich-agency-75207
05/31/2022, 3:11 PM