gcloud alpha topic flags-file Stay organized with collections Save and categorize content based on your preferences.
- NAME
- gcloud alpha topic flags-file - --flags-file=YAML_FILE supplementary help
- DESCRIPTION
(ALPHA)The--flags-file=YAML-FILEflag, available toallgcloudcommands, supportscomplex flag values in any command interpreter.Complex flag values that contain command interpreter special characters may bedifficult to specify on the command line. The combined list of
specialcharacters across commonly used commandinterpreters (shell, cmd.exe, PowerShell) is surprisingly large. Among them are", ', `, *, ?, [, ], (, ), $, %, #, ^, &, |, {, }, ;, \, <,>,space,tab,newline. Add to that the separator characters forlistanddictvalued flags, and it becomes all butimpossible to construct portable command lines.The
--flags-file=YAML-FILEflag solves thisproblem by allowing command line flags to be specified in a YAML/JSON file.String, numeric, list and dict flag values are specified using YAML/JSONnotation and quoting rules.Flag specification uses dictionary notation. Use a list of dictionaries forflags that must be specified multiple times.
For example, this YAML file defines values for Boolean, integer, floating point,string, dictionary and list valued flags:
--boolean:--integer:123--float:456.789--string:A string value.--dictionary:a=b:c,de,f:g=hi:nonej=k=l:m=$n,o=%p"y:":":z"meta:-key:foovalue:bar-key:abcvalue:xyz--list:-a,b,c-x,y,z
If the file is named
my-flags.yamlthen the command line flag--flags-file=my-flags.yamlwill set the specified flags on anysystem using any command interpreter.--flags-filemay be specifiedin a YAML file, and its value can be a YAML list to reference multiple files.This example specifies the
--metadataflag multiple times:---metadata:abc--integer:123---metadata:xyz
Each
--flags-filearg is replaced by its contents, so normal flagprecedence applies. For example, givenflags-1.yaml:--zone:us-east2-a
flags-2.yaml:--verbosity:info--zone:us-central1-a
and command line:
gcloudcomputeinstancesdescribe\--flags-file=flags-1.yamlmy-instance--flags-file=flags-2.yaml
the effective command line is:
gcloudcomputeinstancesdescribe\--zone=us-east2-amy-instance--verbosity=info--zone=us-central1-a
using zone
us-central1-a(notus-east2-a, becauseflags-2.yaml, to the right offlags-1.yaml, has higherprecedence).- NOTES
- This command is currently in alpha and might change without notice. If thiscommand fails with API permission errors despite specifying the correct project,you might be trying to access an API with an invitation-only early accessallowlist. These variants are also available:
gcloudtopicflags-filegcloudbetatopicflags-file
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-22 UTC.