06-11-2025 06:31 AM
I am using the Meraki Terraform provider to make changes to our Dashboards. We have one in Europe and one in China. Every time I want to make a change I have to change my user environment variables API key, then reboot on Win11. Does anyone know of a way to update API keys like this without having to do a reboot?
Solved! Go to Solution.
06-11-2025 01:57 PM
Hi,
You can update environment variables in Windows 11 without rebooting your system.
Try this:
Open Command Prompt as an administrator.
Run the command setx API_KEY "your_new_api_key".
To refresh the environment variables, run the command refreshenv
Refresh Environment Variables in Windows 11 (Without Reboot)
06-11-2025 08:14 AM
I'm guessing you are storing it in a system variable? Take a look at this post, technically it's Linux but you should be able to store the variable somewhere else: https://community.meraki.com/t5/Developers-APIs/MERAKI-API-KEY-Environment-Variable/m-p/246099#M11224
06-11-2025 08:33 AM
It's the environment variables for the user account rather than system. Sadly that link doesn't help much I'm afraid.
06-11-2025 08:41 AM
Here's a general document on how terraform uses variables: https://spacelift.io/blog/how-to-use-terraform-variables#variable-substitution-using-cli-and-tfvars that also may help you adjust your runs and If not I have to imagine someone else will be able to answer more directly soon.
06-11-2025 12:16 PM
I'm not familiar with Terraform, but check out dotenv. That lets you persistently store API keys.
I did have a post about using it many years ago, but alas, it appears to have been archived now.
06-11-2025 03:58 PM
06-11-2025 01:57 PM
Hi,
You can update environment variables in Windows 11 without rebooting your system.
Try this:
Open Command Prompt as an administrator.
Run the command setx API_KEY "your_new_api_key".
To refresh the environment variables, run the command refreshenv
Refresh Environment Variables in Windows 11 (Without Reboot)
06-12-2025 02:03 AM
Thanks a lot for replying, using "refreshenv" after updating the API keys, then restarting my Visual Studio sorts this out. Saves me a time consuming reboot!
06-12-2025 07:51 AM
I had the same idea. However the risk of leaking the API credentials to GitHub was too big with that approach, so opted for keeping API keys out of the actual Terraform files.
06-12-2025 08:05 AM
hadn't considered PowerShell, thanks
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide