-
Notifications
You must be signed in to change notification settings - Fork 258
Closed
Closed
Copy link
Labels
area/docsImprovements or additions to documentationImprovements or additions to documentationkind/enhancementImprovements or new featuresImprovements or new featuresresolution/fixedThis issue was fixedThis issue was fixed
Description
Specifically referring to the "Accessing Configuration from Code" section, unless you are familiar with a specific programming language, it is not very clear how to actually do this in code. For example, the C# code example shows the following:
var config = new Pulumi.Config();
var name = config.Require("name");
var lucky = config.GetInt32("lucky") ?? 42;
var secret = config.RequireSecret("secret")When what it should really show is something like this:
using Pulumi;
using System.Threading.Tasks;
using System.Collections.Generic;
class Program
{
static async Task<int> Main(string[] args)
{
return await Deployment.RunAsync(() =>
{
// Import the configuration values
var config = new Config();
// Retrieve the value of "myEnvironment"
var myValue = config.Get("myEnvironment") ?? "default-value";
// Return a dictionary of outputs
return new Dictionary<string, object?>
{
["Value"] = myValue
};
});
}
}Metadata
Metadata
Assignees
Labels
area/docsImprovements or additions to documentationImprovements or additions to documentationkind/enhancementImprovements or new featuresImprovements or new featuresresolution/fixedThis issue was fixedThis issue was fixed