If you try and import a completely new Environment from a backup or as a way to duplicate a current environment it will fail when you click save if there are references defined in the import that refer to values that will only be defined once the save has been completed.
Example
Take a very simple Environment with 2 values
_MAC_ADDRESS
REF_TO_MAC_ADDRESS
These will both be defined as “Add Missing Value” within the GUI, now select import secrets with the following
The keys will be populated, but on clicking the save button the following error will be displayed
The secret “REF_TO_MAC_ADDRESS” cannot resolve the reference ${_MAC_ADDRESS}.
Currently, the only way to resolve this is to place some junk into the referenced secret and then delete it after the save. The issue seems to be that import does not consider “” as a valid value and so does not change the state of a secret from “Add Missing Value” to Empty Value". Logically if an import file goes to the bother of expressing a secret as “” that should be considered enough to flag the secret as Empty. The export/download feature supports this logic as it will not list a secret in the output if it is shown as “Add Missing Value”.
Another issue is that there is no easy way to show the values imported when you first create an environment and try and do an import as there is no “Reveal all secrets” button shown.
I just tried reproducing this and wasn’t able to. One thing I did do though was modify the example JSON you provided since it was invalid (it has commas where colons should be and was missing the closing } for your reference value). After adjusting that to the following:
You started with an empty list of secrets as your project was likely to be empty of entries. So when you did the import they were created from the values in the import file. This means that _MAC_ADDRESS was marked as “Empty Value”
Instead, take the project you have created and now create a new environment, this should result in an environment with both secrets defined with the value of “Add Missing Value”, now try the same Import.
It is in this situation that the icon bar that provides the ability to view all secrets is lost.
Okay, I’ve confirmed that does seem to be a bug and we now have an open internal issue tracking it. Thanks for reporting this! In the mean time, you can work around the issue by mousing over the empty field after you’ve done the import to populate it and clicking the “Empty” button that appears on the top-right of the field. After doing that, your save will complete successfully.