Report this

What is the reason for this report?

How to use environment values of type SECRET "On following submissions"?

Posted on October 18, 2020

Your App Specification Reference says the following for the envs/value:

String. The value. If the type is SECRET, the value will be encrypted on first submission. On following submissions, the encrypted value should be used.

Could you please clarify what the last sentence means.

For example, I am declaring an environment variable in my yaml file as follows:

{
  "key": "MAILCHIMP_API_KEY",
  "scope": "RUN_AND_BUILD_TIME",
  "type": "SECRET",
  "value": "MY_UNENCRYPTED_API_KEY_VALUE"
}

Now, based on this:

On following submissions, the encrypted value should be used.

It is not clear if I must re-fetch the yaml file from DigitalOcean in order to get the encrypted values for the value keys? So that on the following submission, my yaml file will have this:

{
  "key": "MAILCHIMP_API_KEY",
  "scope": "RUN_AND_BUILD_TIME",
  "type": "SECRET",
  "value": ";lkajsdf;1lkm23r920s,lc;naksdjv;aldkjvad"
}

Is this correct, or am I misinterpreting the documentation?

Finally, if this is the case, how do I update the value of the value with the new api key when we need to? Do we go to the UI and update it there, and then refetch the yaml file again?

It is a bit confusing, please could you explain the workflow of setting AND updating the values of environment variables of type SECRET

Thanks!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

@ReWild 👋

Your assumptions on this are correct. When you’re submitting a new app or changing values of secret envs, you should submit the spec (or update via the UI) with those values unencrypted. The spec you get in response to that, and the one now persisted as your app desired state, will have that secret value encrypted in-place to look something like this:

{
  "key": "MAILCHIMP_API_KEY",
  "scope": "RUN_AND_BUILD_TIME",
  "type": "SECRET",
  "value": "EV[1:xWTjge/c/Oe6kPy0/AFs916m3LcXMzWO:/RoXzy12ATYCexS2h50jI2tJFTQ9+E415Yldtl4l5Ua0UeHrERbI6epjcnehWKZZ]"
}

As you make updates to your app spec, if you don’t intend to change those encrypted values, then you should just submit with the in-place encrypted values unchanged. If you’d like to make a change to the value itself, you just need to resubmit the spec with the plain-text value, and it will again be encrypted in-place on the app spec.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.