Class Config
Config is a bag of related configuration state. Each bag contains any number
of configuration variables, indexed by simple keys, and each has a name that uniquely
identifies it; two bags with different names do not share values for variables that
otherwise share the same key. For example, a bag whose name is pulumi:foo
, with keys
a
, b
, and c
, is entirely separate from a bag whose name is
pulumi:bar
with the same simple key names. Each key has a fully qualified names,
such as pulumi:foo:a
, ..., and pulumi:bar:a
, respectively.
Assembly: Pulumi.dll
Syntax
public sealed class Config
Constructors
View Source
Config(string?)
Creates a new Config instance. name
is the
configuration bag's logical name and uniquely identifies it. The default is the name of
the current project.
Declaration
public Config(string? name = null)
Parameters
Type |
Name |
Description |
string |
name |
|
Methods
View Source
Get(string)
Loads an optional configuration value by its key, or null if it doesn't exist.
Declaration
public string? Get(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
GetBoolean(string)
Loads an optional configuration value, as a boolean, by its key, or null if it doesn't exist.
If the configuration value isn't a legal boolean, this function will throw an error.
Declaration
public bool? GetBoolean(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
GetInt32(string)
Loads an optional configuration value, as a number, by its key, or null if it doesn't exist.
If the configuration value isn't a legal number, this function will throw an error.
Declaration
public int? GetInt32(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
GetObject<T>(string)
Declaration
public T GetObject<T>(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
Type Parameters
View Source
GetSecret(string)
Loads an optional configuration value by its key, marking it as a secret, or null if it doesn't exist.
Declaration
public Output<string>? GetSecret(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
GetSecretBoolean(string)
Loads an optional configuration value, as a boolean, by its key, making it as a secret or
null if it doesn't exist. If the configuration value isn't a legal boolean, this
function will throw an error.
Declaration
public Output<bool>? GetSecretBoolean(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
GetSecretInt32(string)
Loads an optional configuration value, as a number, by its key, marking it as a secret
or null if it doesn't exist.
If the configuration value isn't a legal number, this function will throw an error.
Declaration
public Output<int>? GetSecretInt32(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
GetSecretObject<T>(string)
Declaration
public Output<T>? GetSecretObject<T>(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
Type Parameters
View Source
Require(string)
Loads a configuration value by its given key. If it doesn't exist, an error is thrown.
Declaration
public string Require(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
RequireBoolean(string)
Loads a configuration value, as a boolean, by its given key. If it doesn't exist, or the
configuration value is not a legal boolean, an error is thrown.
Declaration
public bool RequireBoolean(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
RequireInt32(string)
Loads a configuration value, as a number, by its given key. If it doesn't exist, or the
configuration value is not a legal number, an error is thrown.
Declaration
public int RequireInt32(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
RequireObject<T>(string)
Declaration
public T RequireObject<T>(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
Type Parameters
View Source
RequireSecret(string)
Loads a configuration value by its given key, marking it as a secret. If it doesn't exist, an error
is thrown.
Declaration
public Output<string> RequireSecret(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
RequireSecretBoolean(string)
Loads a configuration value, as a boolean, by its given key, marking it as a secret.
If it doesn't exist, or the configuration value is not a legal boolean, an error is thrown.
Declaration
public Output<bool> RequireSecretBoolean(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
RequireSecretInt32(string)
Loads a configuration value, as a number, by its given key, marking it as a secret.
If it doesn't exist, or the configuration value is not a legal number, an error is thrown.
Declaration
public Output<int> RequireSecretInt32(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
View Source
RequireSecretObject<T>(string)
Loads a configuration value as a JSON string and deserializes the JSON into a JavaScript
object, marking it as a secret. If it doesn't exist, or the configuration value cannot
be converted using Deserialize<TValue>(string, JsonSerializerOptions),
an error is thrown.
Declaration
public Output<T> RequireSecretObject<T>(string key)
Parameters
Type |
Name |
Description |
string |
key |
|
Returns
Type Parameters