Search code examples
gcloudgcloud-cli

gcloud multiple terminals with different configuration active


I work with different environments Staging and production. Typically I need to do things at same time in both environments. Each environment is a gcloud configuration. So I'm always jumping between configurations.

I would like to have different configuration activated in different terminals, is there any way?

When I ran the command bellow, it affect all the terminal, is there any way to affect only the current terminal?

gcloud config configurations activate <config-name>

Any workaround idea would be also useful

Thanks


Solution

  • According gcloud help:

    GLOBAL FLAGS
         ...
         --configuration=CONFIGURATION
            The configuration to use for this command invocation. For more
            information on how to use configurations, run: gcloud topic
            configurations. You can also use the [CLOUDSDK_ACTIVE_CONFIG_NAME]
            environment variable to set the equivalent of this flag for a terminal
            session.
    

    You could run in one terminal

    export CLOUDSDK_ACTIVE_CONFIG_NAME=config-name1
    

    and in another terminal

    export CLOUDSDK_ACTIVE_CONFIG_NAME=config-name2
    

    Hope that's useful.