stocky-butcher-62635
04/08/2022, 3:26 PMyml
file for the environment
RwbPulumiProject:ApplicationName: rwb
(Apparently each setting key must be of the form a:b
The documentation page https://www.pulumi.com/docs/intro/concepts/config/ implies that the first bit is not required but apparently this is untrue.)
Then I try to use it
Config config = new Pulumi.Config();
string applicationName = config.Require("RwbPulumiProject:ApplicationName");
(Is is possible to rename the class from MyStack
? My* really makes my skin crawl.)
But then
C:\Work\Azure\RwbPulumiProject>pulumi up
Previewing update (dev)
View Live: <https://app.pulumi.com/jayallcock/RwbPulumiProject/dev/previews/a321fb21-a32a-4b5d-bd30-61c0e6e68c94>
Type Name Plan Info
+ pulumi:pulumi:Stack RwbPulumiProject-dev create 1 error
Diagnostics:
pulumi:pulumi:Stack (RwbPulumiProject-dev):
error: Running program 'C:\Work\Azure\RwbPulumiProject\bin\Debug\netcoreapp3.1\RwbPulumiProject.dll' failed with an unhandled exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
at object RuntimeTypeHandle.CreateInstance(RuntimeType type, bool publicOnly, bool wrapExceptions, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool hasNoDefaultCtor)
at object RuntimeType.CreateInstanceDefaultCtorSlow(bool publicOnly, bool wrapExceptions, bool fillCache)
at object RuntimeType.CreateInstanceDefaultCtor(bool publicOnly, bool skipCheckThis, bool fillCache, bool wrapExceptions)
at T Activator.CreateInstance<T>()
at Task<int> Pulumi.Deployment+Runner.Pulumi.IRunner.RunAsync<TStack>(IServiceProvider serviceProvider)+() => { }
at Task<int> Pulumi.Deployment+Runner.RunAsync<TStack>(Func<TStack> stackFactory) ---> Pulumi.Config+ConfigMissingException: Missing Required configuration variable 'RwbPulumiProject:RwbPulumiProject:ApplicationName'
please set a value using the command `pulumi config set RwbPulumiProject:RwbPulumiProject:ApplicationName <value>`
at string Pulumi.Config.RequireImpl(string key, string use, string insteadOf)
at string Pulumi.Config.Require(string key)
at new MyStack() in C:/Work/Azure/RwbPulumiProject/MyStack.cs:line 17
--- End of inner exception stack trace ---
C:\Work\Azure\RwbPulumiProject>
billowy-army-68599
string applicationName = config.Require("RwbPulumiProject:ApplicationName");
which means it needs to be set as:
pulumi config set RwbPulumiProject:RwbPulumiProject:ApplicationName
If you change your code to:
string applicationName = config.Require("ApplicationName");
it should workIs is possible to rename the class from MyStack? My* really makes my skin crawl.Yes, of course it's possible. You'd just need to modify the async call
stocky-butcher-62635
04/08/2022, 3:42 PMazure-native:location: uksouth
but that appears to be impossible to read either with or without the prefixgreat-queen-39697
04/08/2022, 3:54 PMpulumi config set
terminal command versus writing them in the YAML file directly. it's of the form pulumi config set <key> <value>
. So, for your example, you would run pulumi config set azure-native:location uksouth
(as an example, here's how someone set up an Azure Native C# Pulumi program)stocky-butcher-62635
04/08/2022, 4:00 PMgreat-queen-39697
04/08/2022, 4:27 PMbillowy-army-68599
string awsNative = config.Require("aws-native");